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
Add protocol detection for get/request calls without explicit protocol #3950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
You can fix the lint CI errors by running yarn lint:fix
. As for the Node 6,8 test failures, seems like there is an issue with the awaiting the promise. Maybe we can convert to just relying on callbacks?
4397405
to
3f7a68d
Compare
Fixed the lint issues. Tracking down the Node v8/6 bug was a little tricker, turned out that was related to how |
You can call `get`/`request` on `http`/`https` without providing an explicit protocol in the request options. In this case the protocol is automatically set based on which module you made the call to. Previously calls like this would result in breadcrumbs and traces without a protocol in the URL creating downstream issues for consumers of Breadcrumbs as the missing protocol results in URL throwing parsing errors. We now attempt to get the protocol by either extracting it from the `agent` passed as part of the request options, or by extracting it from the `globalAgent` on which ever http module is pass in `this`.
3f7a68d
to
18f0e6d
Compare
That's exactly what we had to work around here sentry-javascript/packages/node/src/integrations/http.ts Lines 63 to 71 in 18f0e6d
|
Thanks for getting that merged @kamilogorek, do you have any idea when a new release is gonna get published on npm? Keen to get this patch into production. |
We have a beta release that we test now, so I'd assume it should be out early next week. Most likely Monday. I'll talk with the team today. |
You can call
get
/request
onhttp
/https
without providing anexplicit protocol in the request options. In this case the protocol is
automatically set based on which module you made the call to.
Previously calls like this would result in breadcrumbs and traces
without a protocol in the URL creating downstream issues for consumers
of Breadcrumbs as the missing protocol results in URL throwing parsing
errors.
We now attempt to get the protocol by either extracting it from the
agent
passed as part of the request options, or by extracting it fromthe
globalAgent
on which ever http module is pass inthis
.Fixes #3948
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint
) & (yarn test
).