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

TypeError: Failed to parse URL from /.vscode/extensions/rebornix.ruby-0.28.1/dist/server/tree-sitter.wasm #195159

Open
SmileDMiao opened this issue Oct 9, 2023 · 5 comments
Assignees
Labels
under-discussion Issue is under discussion for relevance, priority, approach

Comments

@SmileDMiao
Copy link

SmileDMiao commented Oct 9, 2023

before vscode update, everything was well, after update vsocde, then Open ruby project and ruby language server start failed.

abort(TypeError: Failed to parse URL from /Users/themadeknight/.vscode/extensions/rebornix.ruby-0.28.1/dist/server/tree-sitter.wasm). Build with -s ASSERTIONS=1 for more info.
(Use `Code Helper (Plugin) --trace-uncaught ...` to show where the exception was thrown)

Node.js v18.15.0
[Error - 21:21:26] Connection to server got closed. Server will not be restarted.
@nirojsapkota
Copy link

Getting the same issue since the update.

@Herschdorfer
Copy link

Herschdorfer commented Oct 10, 2023

I have the same issue now:

TypeError: Failed to parse URL from /home/user/.vscode-server/extensions/rebornix.ruby-0.28.1/dist/server/tree-sitter.wasm

vscode 1.82.0 with latest https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp

@guipace
Copy link

guipace commented Oct 10, 2023

+1 on this issue

@VSCodeTriageBot VSCodeTriageBot added the stale Issues that have not been triaged in an appropriate amount of time label Oct 18, 2023
@dbaeumer dbaeumer assigned rebornix and unassigned dbaeumer and sbatten Oct 18, 2023
@dbaeumer dbaeumer removed triage-needed stale Issues that have not been triaged in an appropriate amount of time labels Oct 18, 2023
@dbaeumer
Copy link
Member

This has nothing to do with the gernal WASM support in VS Code. The ruby language server seems to load a tree-sitter wasm file.

@tt4g
Copy link

tt4g commented Oct 25, 2023

I have researched and posted on this issue (https://qiita.com/tt4q/items/0bffdcaf877d1ca1182a).
However, since it is written in Japanese, many people will not be able to read it, so I will describe the main points.

Electron has been upgraded in Visual Studio Code v1.82, and Node.js has also been upgraded.
The upgraded Node.js now provides a fetch API.

tree-sitter.wasm seems to be built with Emscripten.
Emscripten is a tool to generate .wasm that supports multiple execution environments, and it seems to identify the execution environment by symbols defined at runtime.

Unfortunately, Emscripten had a runtime branch that said "if the fetch API is not defined, it is not Node.js".
And, if it wasn't Node.js, Emscripten would have loaded the .wasm with the fetch API.

The fetch API specification requires support for the http:// and https:// schemes.
Support for the file:// scheme is not required, and the Node.js fetch API does not support it for security reasons (nodejs/node#48554).
However, Emscripten will attempt to load .wasm by fetch("/path/to/tree-sitter.wasm"). This is the cause of the TypeError: Failed to parse URL from /path/to/tree-sitter.wasm error.

Emscripten already fixed this bug (emscripten-core/emscripten#16913).
It would be best to release rebornix.ruby extension that uses tree-sitter.wasm built by Emscripten after bug fixes.
However, rebornix.ruby is no longer maintained.

The workaround I found is a --no-experimental-fetch option that prevents Node.js from defining a fetch API.
Visual Studio Code does not have the ability to pass arguments to Node.js, so use the NODE_OPTIONS environment variable (e.g. NODE_OPTIONS="--no-experimental-fetch" code .).
Note that this workaround will work, but may cause extensions that expect fetch provided by Node.js to stop working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

9 participants