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

HTTP Patcher assumes options argument is an object #16

Closed
omsmith opened this issue Jan 21, 2018 · 3 comments
Closed

HTTP Patcher assumes options argument is an object #16

omsmith opened this issue Jan 21, 2018 · 3 comments
Assignees
Labels

Comments

@omsmith
Copy link
Contributor

omsmith commented Jan 21, 2018

node.js HTTP documentation shows that http.request (or http.get, but there really isn't a difference) can accept an object, string or somewhat more recently, an URL instance.

For the latter two, they are converted to the regular option object, and GET is assumed.

options can be an object, a string, or a URL object. If options is a string, it is automatically parsed with url.parse(). If it is a URL object, it will be automatically converted to an ordinary options object.

HTTP implementation showing the parsing: https://github.com/nodejs/node/blob/5164a12618cf60150db621aebe1f3d89efb9b9aa/lib/_http_client.js#L57

Currently, making an outgoing http request with a string argument results in this error.

TypeError: Cannot set property 'X-Amzn-Trace-Id' of undefined
    at captureOutgoingHTTPs (/home/ec2-user/examples/1/node_modules/aws-xray-sdk-core/lib/patchers/http_p.js:88:40)
    at Object.captureHTTPsGet [as get] (/home/ec2-user/examples/1/node_modules/aws-xray-sdk-core/lib/patchers/http_p.js:148:12)
@haotianw465
Copy link
Contributor

I found the same problem during testing. Will fix it soon. Thanks.

@haotianw465 haotianw465 self-assigned this Jan 23, 2018
@haotianw465
Copy link
Contributor

This fix is merged in and will go out with the next release.

@haotianw465
Copy link
Contributor

Fix rolled out with 1.2.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants