-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
isURL
cannot accurately determine if it is a URL object
#48921
Comments
3 tasks
Can you open a pull request with your proposed changes? |
3 tasks
I known in which node-js version this fix will be included? |
mifi
added a commit
to transloadit/uppy
that referenced
this issue
Jul 31, 2023
mifi
added a commit
to transloadit/uppy
that referenced
this issue
Jul 31, 2023
In the next version of node 20 for sure and in node 18 too after this backported |
pluris
pushed a commit
to pluris/node
that referenced
this issue
Aug 6, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
pluris
pushed a commit
to pluris/node
that referenced
this issue
Aug 7, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Ceres6
pushed a commit
to Ceres6/node
that referenced
this issue
Aug 14, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Ceres6
pushed a commit
to Ceres6/node
that referenced
this issue
Aug 14, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
UlisesGascon
pushed a commit
to UlisesGascon/node
that referenced
this issue
Aug 14, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
RafaelGSS
pushed a commit
that referenced
this issue
Aug 15, 2023
Fixes: #48921 PR-URL: #48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
RafaelGSS
pushed a commit
to RafaelGSS/node
that referenced
this issue
Aug 15, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
RafaelGSS
pushed a commit
that referenced
this issue
Aug 17, 2023
Fixes: #48921 PR-URL: #48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
aduh95
pushed a commit
to aduh95/node
that referenced
this issue
Oct 9, 2023
Fixes: nodejs#48921 PR-URL: nodejs#48928 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
targos
pushed a commit
that referenced
this issue
Nov 27, 2023
Fixes: #48921 PR-URL: #48928 Backport-PR-URL: #50105 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
sercher
added a commit
to sercher/graaljs
that referenced
this issue
Apr 25, 2024
Fixes: nodejs/node#48921 PR-URL: nodejs/node#48928 Backport-PR-URL: nodejs/node#50105 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
sercher
added a commit
to sercher/graaljs
that referenced
this issue
Apr 25, 2024
Fixes: nodejs/node#48921 PR-URL: nodejs/node#48928 Backport-PR-URL: nodejs/node#50105 Fixes: getsentry/sentry-javascript#8552 Fixes: request/request#3458 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
20.5.0
Platform
Darwin 22.2.0
Subsystem
No response
What steps will reproduce the bug?
When using
request
library and@sentry/nodejs
, thehttps/http
will send the request with emptypath
-https://api.io/testing
will becomehttps://api.io
.The reason is
request
library added anhref
field to request args, and Sentry added aprotocol
field:https://github.com/getsentry/sentry-javascript/blob/beec5be5cf90fc13d5c0000419422f51d2d75d1c/packages/node/src/integrations/utils/http.ts#L188-L192
https://github.com/request/request/blob/3c0cddc7c8eb60b470e9519da85896ed7ee0081e/request.js#L729
And when
href
andprotocol
both exist,isURL
will think it's anURL
object and resetpath
topathname+search
, and the above is clearly not a URL object and does not havepathname
node/lib/internal/url.js
Lines 761 to 763 in 36c72c8
node/lib/internal/url.js
Lines 1332 to 1336 in 36c72c8
Having the following code, if the
protocol
andhref
inoptions
, thehttps
will setpath
to empty to requesthttps://64bfcd8c0d8e251fd1117729.mockapi.io
, and withoutprotocol
orhref
, it will requesthttps://64bfcd8c0d8e251fd1117729.mockapi.io/test
as expected.And when run
node test.js
withprotocol
andhref
, it will outputAnd if delete
protocol
orhref
, it will get the correct response[]
How often does it reproduce? Is there a required condition?
Everytime.
What is the expected behavior? Why is that the expected behavior?
No response
What do you see instead?
isURL
cannot accurately determine if it is a URL objectAdditional information
Of course, the
request
library might should not add thehref
field since it is not the correct args forhttp(s).request
, but it's not maintained and there are still a lot of users, it should be fixed.IMO, the root cause is
isURL
cannot accurately determine if it is a URL object, I think it can be fixed byChange
isURL
toOr respect user's
path
by changingurlToHttpOptions
- move...url
to the bottom of options instead of top.The text was updated successfully, but these errors were encountered: