Skip to content

DEP0169 DeprecationWarning: url.parse() when url.resolve() used (node_modules context) #61724

Description

@MikeMcC399

Version

24.x & 25.x - see #61724 (comment) for details

Platform

Linux ubuntu-24.04 6.17.0-14-generic #14~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 15 15:52:10 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

url

What steps will reproduce the bug?

Run example from Legacy URL API url.resolve(from, to)

const url = require('node:url');
url.resolve('/one/two/three', 'four');         // '/one/two/four'
url.resolve('http://example.com/', '/one');    // 'http://example.com/one'
url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'

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

For the above steps, it always reproduces in Node.js 25.4.0 - 25.6.0. It is a regression from Node.js 25.3.0.

If the url.resolve() call is embedded in an npm package, it depends how the corresponding module is called, whether or not a deprecation warning appears. See the additional information section below for examples.

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

The example with only url.resolve() should run without producing a deprecation warning.

The history section of url.resolve(from, to) states that the deprecation was revoked in v15.13.0, v14.17.0 and there is no entry for any higher version.

DEP0169 lists url.parse() explicitly. It does not include any direct reference to url.resolve().

What do you see instead?

$ node url-resolve.js
(node:5802) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
(Use `node --trace-deprecation ...` to show where the warning was created)

Additional information

I originally noticed this with Cypress, on Ubuntu 24.04.3 LTS, Node.js 25.6.0, with steps to reproduce:

cd $(mktemp -d)
npm install cypress
npx cypress install --force

where the call is from /node_modules/cypress/dist/tasks/download.js.

The following steps however do NOT cause any deprecation warning, even though download is also run:

rm -rf ~/.cache/Cypress
cd $(mktemp -d)
npm install cypress

Activity

  1. Renegade334 commented on Feb 7, 2026

    @Renegade334
    Member

    url.resolve(from, to) is essentially url.parse(from).resolve(url.parse(to)) so this falls under DEP0169, similar to url.format(string).

    Not sure there's anything to do but mark it as indirectly deprecated as well. url.resolve() does silently accept Url object arguments, but since the only useful way to get one is from url.parse(), it doesn't really seem worth documenting.

  2. MikeMcC399 commented on Feb 8, 2026

    @MikeMcC399
    ContributorAuthor

    @Renegade334

    Thanks for pointing out the relationship!

    It seems that the change in behavior may have been caused by #60991 in 25.4.0

    For Node.js <25.4.0 in Cypress, using the npm module cypress, no DEP0169 was emitted, and my understanding of the code both before and after #60991 is that there should be no deprecation warning if the call comes from a node_modules location.

    I see that #60991 is planned for backporting in has been backported through #61661 into Node.js 24.13.1 so this may cause an increase in the number of users seeing similar displays of DEP0169. if it is merged including this PR.

    At the moment it does not look like this is a documentation issue from my perspective. It seems more like an unintended change where some situations needing the DEP0169 warning suppressed are actually allowing it to warn when it should not be warning.


    Whatever the outcome here, I will still bring this up as an issue in the cypress repo, as it should be possible to migrate their download.ts module to use the WHATWG URL API instead of the Legacy URL API. Edit: PR cypress-io/cypress#33348 merged for this.

  3. MikeMcC399 commented on Feb 10, 2026

    @MikeMcC399
    Author
  4. Renegade334 commented on Feb 10, 2026

    @Renegade334
  5. MikeMcC399 commented on Feb 10, 2026

    @MikeMcC399
    Author
  6. Renegade334 commented on Feb 10, 2026

    @Renegade334
    Member

    The underlying issue is that the deprecation of url.parse() has indirectly deprecated the majority of the legacy URL API, with the exception of url.format(obj), as the other methods depend on url.parse() internally to convert string input to Url objects. This wasn't really noted at the time, and we now have a scenario where the API as a whole is marked as legacy, but almost all usage is de facto deprecated and (outside of node_modules) emits deprecation warnings.

    cc @jasnell @Trott @anonrig as interested parties in the original deprecation revocation and subsequent re-deprecation of url.parse() – what do you think is the correct resolution here? Do we just mark off url.resolve() as co-deprecated, or are we at the point where we may as well consider just re-deprecating that area of the API?

  7. added
    urlIssues and PRs related to the legacy built-in url module.
    on Feb 10, 2026
  8. Trott commented on Feb 10, 2026

    @Trott
    Member

    cc @jasnell @Trott @anonrig as interested parties in the original deprecation revocation and subsequent re-deprecation of url.parse() – what do you think is the correct resolution here? Do we just mark off url.resolve() as co-deprecated, or are we at the point where we may as well consider just re-deprecating that area of the API?

    Unfortunately, it's been a long time since I've given this any thought. Hopefully @anonrig and @jasnell have viewpoints they can share. Also, let's ping @nodejs/url to see if anyone else on that team has something to say.

  9. anonrig commented on Feb 10, 2026

    @anonrig
    Member

    I think we should just deprecate url.resolve().

  10. MikeMcC399 commented on Feb 11, 2026

    @MikeMcC399
    ContributorAuthor

    In an effort to provide simple repro steps I have unintentionally confused two DEP0169 issues in this one report. Possibly this should be split into two different GitHub issues.

    Non node_modules usage

    Use of url.resolve() in a non node_modules package context results in a DEP0169 warning in release lines 24.x and 25.x, but not in 20.x or 22.x

    cd $(mktemp -d)
    cat > url-resolve.js <<EOT
    const url = require('node:url');
    url.resolve('http://example.com/', '/one');    // 'http://example.com/one'
    EOT
    node url-resolve.js
    Node.js Result
    20.20.0 no deprecation warning
    22.22.0 no deprecation warning
    24.0.0 DEP0169
    24.13.1 DEP0169
    25.0.0 DEP0169
    25.6.1 DEP0169

    url.resolve(from,to) is not marked deprecated in the documentation for any of the currently supported release lines.

    Usage from an npm package installed in node_modules

    Using the npm module cypress@15.10.0's command cypress install results in a deprecation warning for the latest 24.x and 25.x releases only. This is effectively a breaking change within the respective release line.

    cd $(mktemp -d)
    npm install cypress@15.10.0 -D -E --ignore-scripts
    npx cypress cache clear
    npx cypress install
    Node.js Result
    20.20.0 no deprecation warning
    22.22.0 no deprecation warning
    24.0.0 no deprecation warning
    24.11.0 no deprecation warning
    24.13.1 DEP0169
    25.0.0 no deprecation warning
    25.6.1 DEP0169

    For Cypress the issue will be remedied in the next release of Cypress. url.resolve() has been replaced by URL in the cypress install command code. I can also reproduce this by publishing the simple url.resolve() example to GitHub as a package, and then running it after requiring it in a second package.

    The trace shows it being called in node_modules and I understood that usage inside node_modules was supposed to cause the deprecation warning to be suppressed:

    (node:8453) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
        at urlParse (node:url:137:13)
        at Object.urlResolve [as resolve] (node:url:721:10)
        at prepend (/tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:65:36)
        at getUrl (/tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:87:12)
        at /tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:283:24
        at Generator.next (<anonymous>)
    
  11. BridgeAR commented on Feb 11, 2026

    @BridgeAR
    Member

    The mentioned stack trace should not trigger the deprecation warning as far as I can tell due to coming from a node_modules folder and other calls are node internal ones. @legendecas PTAL

    (node:8453) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
        at urlParse (node:url:137:13)
        at Object.urlResolve [as resolve] (node:url:721:10)
        at prepend (/tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:65:36)
        at getUrl (/tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:87:12)
        at /tmp/tmp.hT2HnLgaxi/node_modules/cypress/dist/tasks/download.js:283:24
        at Generator.next (<anonymous>)
    
  12. Renegade334 commented on Feb 11, 2026

    @Renegade334
    Member

    The mentioned stack trace should not trigger the deprecation warning as far as I can tell due to coming from a node_modules folder and other calls are node internal ones. @legendecas PTAL

    url.parse() was configured to only seek 2 frames deep for node_modules; since this is called indirectly by other node:url methods, I think this will need to be at least 4 (to cover the internal url.resolve > Url.prototype.resolve > url.parse stack), or we change the public url.parse to a warning wrapper and have a non-warning internal method as well

  13. jasnell commented on Feb 11, 2026

    @jasnell
    Member

    I'm ok with either (a) deprecating url.resolve(...) or (b) deepening the node_modules check to avoid the issue. (b) is obviously less disruptive.

  14. 1 remaining item

  15. MikeMcC399 commented on Feb 11, 2026

    @MikeMcC399
    ContributorAuthor

    (a) deprecating url.resolve(...)

    That would solve the issue for usage outside of node_modules in 24.x & 25.x

    Edit: follow-on in #61816

  16. MikeMcC399 commented on Feb 14, 2026

    @MikeMcC399
    ContributorAuthor

    I've moved the deprecation documentation issue to #61816 for clarity. This is about documenting that #55017 added Application deprecation (non-node_modules code only) in v24.0.0 explicitly for url.parse() and the implicit deprecation caused by the dependency of url.resolve() on url.parse() needs to be retroactively added to the documentation for v24.0.0.

  17. MikeMcC399 commented on Feb 14, 2026

    @MikeMcC399
    ContributorAuthor

    With the deprecation documentation issue spun off to #61816, this issue can focus on the regression introduced by #60991 which causes url.resolve() usage in a node_modules environment under Node.js 24.13.1 and 25.4.0 - 25.6.0 to emit DEP0169.

    It seems the change from:

     if (!urlParseWarned && !isInsideNodeModules(100, true)) {

    to

     if (!urlParseWarned && !isInsideNodeModules(2)) {

    was too radical and did not take account of a nested call from urlResolve to urlParse.

    Deprecation detection / suppression needs to be changed so that invoking url.resolve() in a node_modules context does NOT emit DEP0169, the same as is the case for url.parse() in a node_modules context.

  18. changed the title [-]DEP0169 DeprecationWarning: url.parse() when url.resolve() used[/-] [+]DEP0169 DeprecationWarning: url.parse() when url.resolve() used (node_modules context)[/+] on Feb 14, 2026
  19. MikeMcC399 commented on Feb 17, 2026

    @MikeMcC399
    ContributorAuthor

    Also reproducible with the following on Windows using Node.js 24.13.1 installed from MSI package:

    cd $(mktemp -d)
    yarn add yarn
  20. MikeMcC399 commented on Feb 24, 2026

    @MikeMcC399
    ContributorAuthor

    This issue remains reproducible for Node.js 24.14.0 LTS and 25.7.0

    export NODE_OPTIONS='--trace-deprecation'
    cd $(mktemp -d)
    npm install cypress@15.10.0 -D -E --ignore-scripts
    npx cypress cache clear
    npx cypress install

    produces:

    (node:3994) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
        at urlParse (node:url:137:13)
        at Object.urlResolve [as resolve] (node:url:721:10)
        at prepend (/tmp/tmp.Bp14h3MLKW/node_modules/cypress/dist/tasks/download.js:65:36)
        at getUrl (/tmp/tmp.Bp14h3MLKW/node_modules/cypress/dist/tasks/download.js:87:12)
        at /tmp/tmp.Bp14h3MLKW/node_modules/cypress/dist/tasks/download.js:283:24
        at Generator.next (<anonymous>)
    

    Edit: Still reproducible in Node.js 24.14.1, no longer reproducible in Node.js >=25.8.1 including 25.9.0

  21. MikeMcC399 commented on Feb 26, 2026

    @MikeMcC399
    ContributorAuthor

    #62002 is submitted to formally confirm deprecation of url.resolve() in a non-node_modules context and to clarify that the definition of DEP0169: Insecure url.parse() as:

    Type: Application (non-`node_modules` code only)
    

    also applies to url.resolve(). In other words, there should be no deprecation warning for node_modules usage of url.resolve()

  22. MikeMcC399 commented on Mar 11, 2026

    @MikeMcC399
    ContributorAuthor

    Verified fixed in Node.js 25.8.1 with test from #61724 (comment) above.

  23. MikeMcC399 commented on Apr 16, 2026

    @MikeMcC399
    ContributorAuthor

    Verified fixed in Node.js 24.15.0 with test from #61724 (comment) above.

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