Fixes #10610 Deprecation Warning : url.parse() is deprecated in Node.…#10625
Merged
Conversation
…js v22 (via follow-redirects)
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Confidence score: 3/5
- There is a concrete regression risk in
lib/defaults/index.js: prioritizingfetchas the Node default adapter may bypasshttp-adapter-specific Node options and change runtime behavior for existing users. - Given the issue severity (7/10) and high confidence (8/10), this is more than a minor housekeeping concern and introduces some meaningful merge risk.
- Pay close attention to
lib/defaults/index.js- adapter selection order may break Node configurations that rely onhttpadapter options.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/defaults/index.js">
<violation number="1" location="lib/defaults/index.js:43">
P1: Changing Node default adapter priority to fetch can cause functional regressions by bypassing http-adapter-specific Node options.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
3 issues found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="sandbox/server.js">
<violation number="1" location="sandbox/server.js:79">
P1: `pathname` is declared as `const` but reassigned for `/`, causing a runtime TypeError on root requests.</violation>
</file>
<file name="lib/defaults/index.js">
<violation number="1">
P1: Default adapter priority regression in Node: `http` is selected before `fetch`, likely reintroducing the DEP0169 warning path via `follow-redirects`.</violation>
</file>
<file name="examples/abort-controller/server.js">
<violation number="1" location="examples/abort-controller/server.js:2">
P2: Uncaught `URL` parsing error on untrusted `req.url` can crash the request handler/process.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
57b403e to
5c1244f
Compare
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
jasonsaayman
approved these changes
Apr 2, 2026
Member
jasonsaayman
left a comment
There was a problem hiding this comment.
thanks for the contribution 🔥
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix DEP0169 warning in Node.js 18+ by prioritizing fetch adapter
This pull request fixes the DEP0169 warning caused by follow-redirects using the legacy url.format() API internally when building redirect URLs. Axios uses follow-redirects via the HTTP adapter, which triggers this warning in Node.js 18+.
Solution:
In Node.js 18+ (where platform.isNode is true and global.fetch exists), the adapter priority is updated to ['xhr', 'fetch', 'http'].
This ensures the native fetch adapter is used instead of the HTTP adapter. Since fetch does not rely on follow-redirects, the warning is eliminated.
On older Node.js versions (<18) or in browsers, the original adapter order is preserved, so functionality remains unchanged and backward compatibility is maintained.
Summary by cubic
Fixes #10610 by replacing deprecated
url.parsewithURL/URLSearchParamsin examples, sandbox, and tests. Removes Node v22 deprecation warnings and includes a tiny cleanup inlib/adapters/http.js(no behavior change).Description
url.parsewithURL/URLSearchParamsinexamples/abort-controller/server.js,sandbox/server.js, and tests.examples/abort-controller/server.js.lib/adapters/http.js(formatting only).Docs
url.parsetoURL/URLSearchParams.Testing
tests/unit/adapters/http.test.jsto useURL; behavior unchanged.Written for commit 6da3bf4. Summary will update on new commits.