Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppStream 2.0 createStreamingURL -- Incorrect Endpoint #1189

Closed
seliger opened this issue Feb 19, 2017 · 3 comments · Fixed by #1192
Closed

AppStream 2.0 createStreamingURL -- Incorrect Endpoint #1189

seliger opened this issue Feb 19, 2017 · 3 comments · Fixed by #1192
Labels
bug This issue is a bug. pr-under-review

Comments

@seliger
Copy link

seliger commented Feb 19, 2017

I am attempting to write a PHP script that uses createStreamingURL() to shuffle users over to AppStream to run apps. However, when I attempt to do this, I am seeing the following in the debug output:

Fatal error:  Uncaught exception 'Aws\Appstream\Exception\AppstreamException' with message 'Error executing "CreateStreamingURL" on "https://appstream.us-east-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://appstream.us-east-1.amazonaws.com` resulted in a `404 Not Found` response:
<UnknownOperationException/>

 Unable to parse error information from response - Error parsing JSON: unexpected character'

exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: `POST https://appstream.us-east-1.amazonaws.com` resulted in a `404 Not Found` response:
<UnknownOperationException/>

' in /home/ubuntu/workspace/appstream-auth/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111
Stack trace:
#0 /home/ubuntu/workspace/appstream-auth/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /home/ubuntu/workspace/appstream-auth/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHtt in /home/ubuntu/workspace/appstream-auth/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php on line 192

If you notice, the URL it is sending the request to is appstream.us-east-1.amazonaws.com. Invoking the same call using the CLI with debugging turned on shows something different -- and it works:

2017-02-19 21:17:40,079 - MainThread - botocore.hooks - DEBUG - Event request-created.appstream2.CreateStreamingURL: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f0bb3cf5410>>
2017-02-19 21:17:40,080 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2017-02-19 21:17:40,080 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
POST
/

content-type:application/x-amz-json-1.1
host:appstream2.us-east-1.amazonaws.com
x-amz-date:20170219T211740Z
x-amz-target:PhotonAdminProxyService.CreateStreamingURL

content-type;host;x-amz-date;x-amz-target
1cf4403fe47d8a04d4bae8ac1702fd31a6cb0dbb7b4416734f51fc445bcc98c5
2017-02-19 21:17:40,080 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20170219T211740Z
20170219/us-east-1/appstream/aws4_request
dd06cfd0468c5baee613c52d113014f643462a407de176ac6592dff97056ee8d
2017-02-19 21:17:40,081 - MainThread - botocore.auth - DEBUG - Signature:
fe1ed79fe16808c1144ea58913c7a82326bc07808f9688782bb193340306ae42
2017-02-19 21:17:40,089 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [POST]>
2017-02-19 21:17:40,090 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): appstream2.us-east-1.amazonaws.com
2017-02-19 21:17:40,316 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1" 200 448

You will notice here, using appstream_2_.us-east-1.amaazonaws.com, that the CLI gets a 200 and happily returns a JSON object containing the requested streaming URL.

Please investigate. I tried mucking about in the SDK code trying to get it to point at appstream2, but that proved to be more difficult than originally thought.

Thank you!
Corey

php-debug.txt
cli-debug.txt

@seliger
Copy link
Author

seliger commented Feb 19, 2017

Also --

coreyseliger:~/workspace/appstream-auth $ composer info
aws/aws-sdk-php        3.22.7 AWS SDK for PHP - Use Amazon Web Services in your PHP project
guzzlehttp/guzzle      6.2.2  Guzzle is a PHP HTTP client library
guzzlehttp/promises    v1.3.1 Guzzle promises library
guzzlehttp/psr7        1.3.1  PSR-7 message implementation
mtdowling/jmespath.php 2.4.0  Declaratively specify how to extract elements from a JSON document
psr/http-message       1.0.1  Common interface for HTTP messages

@seliger
Copy link
Author

seliger commented Feb 19, 2017

It is possible to work around this issue:

$appstream = $sdk->createAppstream([ 
        'endpoint' => 'https://appstream2.us-east-1.amazonaws.com/' 
    ]);

(Not sure if it breaks the rest of the API, but does allow me to continue with this specific use case...)

@cjyclaire
Copy link
Contributor

cjyclaire commented Feb 20, 2017

@seliger Thanks for the information! This is a know bug, PR #1171 is opened to fix the issue, we are working on that.
A proposed workaround currently is having endpoint param hardcoded in the client as:

$appStream = new AppStreamClient([
    'region' => 'us-east-1',
    'version' => 'latest',
    'endpoint' => 'https://appstream2.us-east-1.amazonaws.com/'
]);

Appreciate your patience : )

Update: tracking #1192 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. pr-under-review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants