Sitelet https://github.com/nodejs/node/issues/48850
Skip to content

URL.parse fails on URLs with comma separated hosts #48850

Description

@evansnicholas

Version

v18.17.0

Platform

Linux XXXXX 5.4.0-137-generic #154-Ubuntu SMP Thu Jan 5 17:03:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Parsing URL's with comma separated hosts throws a TypeError [ERR_INVALID_URL]: Invalid URL error. This URL parsed correctly in in node v18.16.1.

const URL = require('url');
URL.parse("mongodb://127.0.0.1,127.0.0.2:27017")

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

Always.

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

URL parsed rather than exception thrown.

What do you see instead?

An exception is thrown.

Additional information

This is a serious problem because such URL's are used reguarly when configuring eg DB connections which now fail. This is the case with the MongoDB driver for instance.

Activity

  1. changed the title [-]URL.parse fails on URLs with comma separated domains[/-] [+]URL.parse fails on URLs with comma separated hosts[/+] on Jul 20, 2023
  2. added
    urlIssues and PRs related to the legacy built-in url module.
    on Jul 20, 2023
  3. 3XC1T3D commented on Jul 20, 2023

    @3XC1T3D

    With node v18.17.0, Ada 2.5.0 is delivered and we have the same issue.

    We noticed that in node v20.4.0 , Ada 2.5.1 is delivered and there we dont have the issue.

    Maybe it is possible to update also to Ada 2.5.1 in node v18.17.1 or something?

  4. anonrig commented on Jul 20, 2023

    @anonrig
    Member

    cc @nodejs/url

  5. lpinca commented on Jul 21, 2023

    @lpinca
    Member

    I don't think it is related to Ada? AFAIK url.parse() is the legacy URL parser.

  6. anonrig commented on Jul 21, 2023

    @anonrig
    Member

    url.parse calls toASCII method which is implemented under ada::idna::to_ascii. to_ascii returns an empty string if the value is invalid. In this particular case, we are receiving an empty string, which may be caused by this. Investigating it under: #48855

  7. lpinca commented on Jul 21, 2023

    @lpinca
    Member

    Ah ok.

  8. 3XC1T3D commented on Jul 21, 2023

    @3XC1T3D

    strange that it doesnt cause problems under ada 2.5.1 🙈

  9. 3 remaining items

  10. exiadbq commented on Aug 28, 2023

    @exiadbq

    With node v18.17.0, Ada 2.5.0 is delivered and we have the same issue.

    We noticed that in node v20.4.0 , Ada 2.5.1 is delivered and there we dont have the issue.

    Maybe it is possible to update also to Ada 2.5.1 in node v18.17.1 or something?

    Still happening in v18.17.1, any plan to fix it?

  11. anonrig commented on Aug 28, 2023

    @anonrig
    Member

    It is fixed at #48873 and will be released in the next Node 18 release.

  12. anonrig commented on Sep 21, 2023

    @anonrig
    Member

    Resolved with latest v18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    urlIssues and PRs related to the legacy built-in url module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions