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

"URL.parse()" works differently in diff versions of Nodejs #49024

Closed
SEWeiTung opened this issue Aug 5, 2023 · 8 comments
Closed

"URL.parse()" works differently in diff versions of Nodejs #49024

SEWeiTung opened this issue Aug 5, 2023 · 8 comments
Labels
url Issues and PRs related to the legacy built-in url module. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

Comments

@SEWeiTung
Copy link

SEWeiTung commented Aug 5, 2023

Version

18.17.0 or 18.16.X

Platform

N/A (including Windows, Mac and Linux)

Subsystem

N/A

What steps will reproduce the bug?

  1. Open any dev env.
  2. Write a very simple code, something like this:
const URL = require('url');
const result = URL.parse('dubbo://300.149.250.173:20880/demo.DemoService?anyhost=true&application=demo-provider&dubbo=2.0.0&generic=false&interface=demo.DemoService&loadbalance=roundrobin&methods=sayHello&owner=william&pid=81281&side=provider&timestamp=1481613276143');

How often does it reproduce? Is there a required condition?

Always,without a required condition

What is the expected behavior? Why is that the expected behavior?

Works properly as what we see in the previous version (Before Node 18.17.0、18.16.X, it works fine without any exceptions).

What do you see instead?

TypeError [ERR_INVALID_URL]: Invalid URL\n' +
' at new NodeError (node:internal/errors:405:5)\n' +
' at Url.parse (node:url:445:17)\n' +
' at new urlParse (node:url:167:13)\n'

Additional information

  1. This ONLY happens in Nodejs since 18.17.0 or 18.16.X, I cannot reproduce it any more in the other versions of Nodejs (Even in the previous versions of Nodejs like "18.14.X", we cannot reproduce it.....

  2. When I change "300.149.250.173" to "www.randomAddress.com", everything works fine, why (I mean it seems I cannot use numeric address but Latin-based address....)?

@SEWeiTung SEWeiTung changed the title "URL.parse()" works bad in diff versions of Nodejs "URL.parse()" works differently in diff versions of Nodejs Aug 5, 2023
@VoltrexKeyva VoltrexKeyva added the url Issues and PRs related to the legacy built-in url module. label Aug 5, 2023
@anonrig
Copy link
Member

anonrig commented Aug 5, 2023

cc @nodejs/url

@anonrig
Copy link
Member

anonrig commented Aug 5, 2023

I think this issue is related to the missing backport in v18. Does this issue occur in latest node 20 or main branch?

@SEWeiTung
Copy link
Author

SEWeiTung commented Aug 6, 2023

The ada library has no issue with this URL:

https://www.ada-url.com/playground?url=dubbo%3A%2F%2F300.149.250.173%3A20880%2Fdemo.DemoService%3Fanyhost%3Dtrue%26application%3Ddemo-provider%26dubbo%3D2.0.0%26generic%3Dfalse%26interface%3Ddemo.DemoService%26loadbalance%3Droundrobin%26methods%3DsayHello%26owner%3Dwilliam%26pid%3D81281%26side%3Dprovider%26timestamp%3D1481613276143

cc @anonrig

Yes.

I think this issue is related to the missing backport in v18. Does this issue occur in latest node 20 or main branch?

For Nodejs 20 or the other versions, They're all right with me.
What I found is between Nodejs 18.16.X and 18.17.0.

PS: Even in Nodejs 18.14.X, it works properly.

@anonrig anonrig added the v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. label Aug 6, 2023
@erwinheitzman
Copy link

erwinheitzman commented Aug 8, 2023

We are running into a similar or perhaps the same issue where v16, v18.16.0 and v20 all work whereas for v18.17.0 we have a failing test with the following result for the url difference:
Screenshot 2023-08-08 at 10 27 59
Perhaps this helps.

@lemire
Copy link
Member

lemire commented Aug 8, 2023

Looks like a missing backport to 18?

cc @anonrig

@lpinca
Copy link
Member

lpinca commented Aug 10, 2023

Maybe #48873?

@anonrig
Copy link
Member

anonrig commented Aug 28, 2023

Backport has landed in the staging branch, and will be released in the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
url Issues and PRs related to the legacy built-in url module. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.
Projects
None yet
Development

No branches or pull requests

6 participants