-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Use electron.net
in the github-authentication
extension
#207867
Comments
@deepak1556 @alexdima @chrmarti do either of you know what work is involved for me to adopt this? |
Fetch API in Node.js and Electron share the same API design, so you should be able to just swap in the imports and everything should just work. The minimal changes needed would be
However, I would recommend to try this out as experiment similar to how copilot extension does it, refs https://github.com/microsoft/vscode-copilot/pull/3461 |
@TylerLeonhardt I noticed #229202 going in and just wanted make sure github-authentication doesn't get left behind 😄 I don't think it will pick up #228476 currently since it's using vscode/extensions/github-authentication/src/node/fetch.ts Lines 5 to 7 in f26394d
|
Note that I will change the default for #229202 to be off for the stable release. Since this affects all extensions using |
@devm33 do you have any way of confirming that this is now working for folks in Insiders? |
This bug has been fixed in the latest release of VS Code Insiders! @devm33, you can help us out by commenting If things still don't seem right, please ensure you're on version a1fc8c1 of Insiders (today's or later - you can use Happy Coding! |
@TylerLeonhardt I think I'm seeing an issue testing on latest insiders:
Is there a way to get more verbose logging or see if any error was thrown? It looks like it's failing on this fetch:
But I don't see where the |
I have seen |
@chrmarti Yes that appears to be spot on GitHub Copilot Chat Diagnostics outputGitHub Copilot Chat
NetworkUser Settings: "http.proxy": "http://localhost:9999",
"github.copilot.advanced.debug.useElectronFetcher": true,
"github.copilot.advanced.debug.useNodeFetcher": false,
"github.copilot.advanced.debug.useNodeFetchFetcher": true Connecting to https://api.github.com:
Connecting to https://api.githubcopilot.com/_ping:
DocumentationIn corporate networks: Troubleshooting firewall settings for GitHub Copilot. Running a proxy, but not in wsl or any vs code remote, so I'm not sure why electron wouldn't be enabled, per: https://github.com/devm33/vscode/blob/419205a8ff1252fc6a3a8e085b8645f2ab51a0ec/extensions/github-authentication/src/node/fetch.ts#L6-L12 The |
Yes, nothing special there. It runs on the client's extension host |
😕 Ok I'm lost on the difference here then: vscode/extensions/microsoft-authentication/src/node/fetch.ts Lines 6 to 12 in 724d644
vscode/extensions/github-authentication/src/node/fetch.ts Lines 6 to 12 in 724d644
It's also confusing the vscode-proxy-agent would fail for the node based fetch for github-authentication. Other requests in the extension host are working fine |
I'll open a new issue for Node.js' fetch failing. Not sure why the above code snippets wouldn't do the same, maybe something with module loading? Best to step through with the debugger. |
Should 6263fff be in the latest insiders? Looking at Is the github-authentication extension published from the same commit as the main app? Version: 1.97.0-insider (Universal) |
It's there I'm pretty sure:
also commits are almost always in Insiders in the next business day, for context. |
Thanks @TylerLeonhardt I think I see the issue. In the bundled output, 2556: (e, t, n) => {
const r = n(9896),
i = n(6928),
o = i.join(__dirname, "path.txt");
e.exports = (function () {
let e;
if (
(r.existsSync(o) && (e = r.readFileSync(o, "utf-8")),
process.env.ELECTRON_OVERRIDE_DIST_PATH)
)
return i.join(
process.env.ELECTRON_OVERRIDE_DIST_PATH,
e || "electron"
);
if (e) return i.join(__dirname, "dist", e);
throw new Error(
"Electron failed to install correctly, please delete node_modules/electron and try installing again"
);
})(); which is the https://www.npmjs.com/package/electron package. I think we need to add Though notably that's not what extensions/microsoft-authentication/extension.webpack.config.js has so I'm not sure how (if?) that's working. |
Keep in mind, Microsoft Auth has a new implementation that doesn't use |
vscode/extensions/shared.webpack.config.js Lines 58 to 65 in bda07cf
that way future stuff (if so) doesn't fall for the same trap. |
Oh that's interesting will have to take a look at what they're doing. Here's PR for the electron change #239134 Edit: I'll update to move it to the defaults |
Updated c4b0c17 |
Fixed in #239134 |
With #192899 and #206822 extensions have the ability to use
electron.net.fetch
to benefit from improved proxy and networking capabilities offered by Electron and Chromium.For
github-authentication
, this could replace the use ofnode-fetch
.The text was updated successfully, but these errors were encountered: