Use global fetch instead of cross-fetch to eliminate node-fetch url.parse deprecation#8822
Draft
Copilot wants to merge 2 commits into
Draft
Use global fetch instead of cross-fetch to eliminate node-fetch url.parse deprecation#8822Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
… deprecation Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix deprecation warning for url.parse
Use global fetch instead of cross-fetch to eliminate node-fetch url.parse deprecation
Jul 1, 2026
Member
|
@copilot, will global fetch work in the browser? |
Contributor
Author
Yes. In the browser/web-worker extension host, |
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.
Users see
[DEP0169] DeprecationWarning: url.parse()in the VS Code Window output. The warning originates from this extension: importingfetchfromcross-fetchpulls innode-fetch@2.6.7on the Node/desktop target, which calls the deprecatedUrl.parse()on every request.The main REST path (
@octokit/rest@22) already usesglobalThis.fetch, so the remaining call sites were the only ones still routing throughnode-fetch: the Apollo/GraphQL link, avatar image fetches, the Copilot API, and enterprise-server detection.Changes
cross-fetchimports incredentials.ts,githubServer.ts,common/uri.ts, andcopilotApi.tsso these use the environment's globalfetch(Node 20+ / browser), which is WHATWG-URL based and never callsurl.parse().domtolibin the Nodetsconfig.json. DOM types (Element,BlobPart, DOMfetch/Response) were previously supplied transitively bycross-fetch's type defs (/// <reference lib="dom" />); this makes them explicit, matching the browser and test tsconfigs.-import fetch from 'cross-fetch'; import * as vscode from 'vscode';Notes
node-fetch/url.parse()code is no longer present in the bundled output.cross-fetchremains as a dependency and its webworker webpack alias is left in place (now inert) to keep the change minimal and avoid lockfile churn; it can be removed in a follow-up.