Skip to content
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

Failed to download: fetch$1 is not a function #6757

Closed
kafji opened this issue Dec 8, 2020 · 8 comments
Closed

Failed to download: fetch$1 is not a function #6757

kafji opened this issue Dec 8, 2020 · 8 comments

Comments

@kafji
Copy link
Contributor

kafji commented Dec 8, 2020

After upgrading to latest nightly (v0.3.409-nightly) my Vscode failed to download the language server binary and shows Failed to download: fetch$1 is not a function error popup.

Screenshot from 2020-12-08 09-42-02_cropped

I've tried the "Update Github Auth Token" and use my personal account token but the error persist.

RA client log:

DEBUG [12/8/2020, 9:41:49 AM]: Issuing request for released artifacts metadata to https://api.github.com/repos/rust-analyzer/rust-analyzer/releases/tags/nightly
ERROR [12/8/2020, 9:45:42 AM]: [TypeError: fetch$1 is not a function
	at Object.fetchRelease (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:17893:28)
	at /home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18130:26
	at downloadWithRetryDialog (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18277:26)
	at bootstrapExtension (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18129:27)
	at bootstrap (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18105:11)
	at async tryActivate (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18028:24)
	at async activate (/home/asd/.vscode/extensions/matklad.rust-analyzer-0.3.409-nightly/out/src/main.js:18002:5)
	at async Promise.all (index 0)]

Copied from https://users.rust-lang.org/t/ra-failed-to-download-fetch-1-is-not-a-function/52464.

@kafji kafji changed the title RA: Failed to download: fetch$1 is not a function Failed to download: fetch$1 is not a function Dec 8, 2020
@hammypants
Copy link

Also getting this on nightly-- it's basically dead in the water atm.

@kafji
Copy link
Contributor Author

kafji commented Dec 8, 2020

@kafji
Copy link
Contributor Author

kafji commented Dec 8, 2020

diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 9ba17b7b5..22cb38552 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -1,6 +1,7 @@
 // Replace with `import fetch from "node-fetch"` once this is fixed in rollup:
 // https://github.com/rollup/plugins/issues/491
-const fetch = require("node-fetch") as typeof import("node-fetch")["default"];
+// const fetch = require("node-fetch") as typeof import("node-fetch")["default"];
+import fetch from "node-fetch";
 
 import * as vscode from "vscode";
 import * as stream from "stream";

Does fix the issue.

bors bot added a commit that referenced this issue Dec 8, 2020
6759: Remove workaround & fix fetch$1 is not a function r=lnicola a=kafji

Remove workaround for rollup/plugins#491
because it's fixed in 15.0
https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md#v1500.

Also fix fetch$1 is not a function error
#6757.

Co-authored-by: Kafji <k@kafji.net>
@kafji
Copy link
Contributor Author

kafji commented Dec 8, 2020

Patched.

@mexus
Copy link

mexus commented Dec 8, 2020

So for today we've got a broken nightly, right? Is it possible to somehow update it before tomorrow?

Re-installing the extension saves the day :)

@kafji
Copy link
Contributor Author

kafji commented Dec 8, 2020

So for today we've got a broken nightly, right?

I believe so.

Is it possible to somehow update it before tomorrow?

Yes. You can download the server binary and copy it to the expected path.

@mexus
Copy link

mexus commented Dec 8, 2020

Thanks @kafji ! So far re-installing the extension helped, but who knows what happens tomorrow.. it's still 2020 after all..

@chinoto
Copy link

chinoto commented Dec 8, 2020

I was just about to open an issue, but then I decided to check the closed issues, thanks for the fix, @kafji, and how to get the fix to stick, @mexus. (Do I have my comma grammar right?)

Matthias-Fauconneau pushed a commit to Matthias-Fauconneau/rust-analyzer that referenced this issue Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants