graphql / graphiql

GraphiQL & the GraphQL LSP Reference Ecosystem for building browser & IDE tools.
MIT License
15.96k stars 1.71k forks source link

[lsp-server] 🐞 Error: Cannot find module 'astrojs-compiler-sync' #3516

Open M1CK431 opened 7 months ago

M1CK431 commented 7 months ago

Is there an existing issue for this?

Current Behavior

Server crash with error:

Error: Cannot find module 'astrojs-compiler-sync'

Expected Behavior

Server starts without error

Steps To Reproduce

Simply install the latest v0.9.0 of "GraphQL: Language Feature Support" vscode extension.

Environment

Anything else?

Rollback on v0.8.25 => no error

acao commented 7 months ago

@M1CK431 oh noo... i manually tested with vscode-graphql vsix and everything!

M1CK431 commented 7 months ago

I'm using Open VSX as extensions marketplace, don't know if it may have an impact or not 🤷🏼‍♂️ https://open-vsx.org/extension/GraphQL/vscode-graphql

Also, I try to uninstall / reinstall => same issue 😢

acao commented 7 months ago

huh, are you using it with astro files? i cannot reproduce it from the vscode marketplace. i will try again after work

it might be an issue that only effects the ovsx bundle and not the vsix bundle. sadly both can only be manually tested 🥺

M1CK431 commented 7 months ago

I haven't any astro file in my projet (in fact I even don't know what it is 🤭). I just try to install it manually using the .vsix file downloaded from Open VSX => same error

Perhaps there is an extra check to do on astrojs-compiler-sync existence in the project dependencies? 🤷🏼‍♂️

M1CK431 commented 7 months ago

Extra info: I'm using Code OSS, again dunno if it may have any impact.

Dalichowski commented 7 months ago

image I have the same issue here :sweat:

joeiw commented 7 months ago

I'm also experiencing this error on v0.9.1

[Error - 11:48:13] vscode-graphql client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 node:internal/modules/cjs/loader:966 throw err; ^

Error: Cannot find module 'astrojs-compiler-sync' Require stack:

jeremie-stripe commented 7 months ago

Having the same problem, from a cursory inspection it seems this only manifest in situation where the LSP server is ran with a plain nodejs runtime (v18.15.0) rather than the bundled Electron runtime. This happens as well when you are using the remote extensions (e.g. SSH). TL;DR I would bet the problem is that nodejs is trying to load code/modules differently from how Electron does it when running locally with the official distribution.

acao commented 7 months ago

Last week I upgraded ovsx cli and made a new release in the hopes that this would fix the vsix build for ovsx users. For vsce vsix builds it works fine.

Regarding running the LSP outside of an IDE client build - It is marked as a dependency of the graphql-language-service-server, and the LSP tests are passing for node 18, so make sure your environments have been updated for this new dependency.

M1CK431 commented 7 months ago

@acao are you speaking about v0.9.1? If yes, I already try it and experiencing the same issue. Also, if my node version could be important, I'm currently using v21.6.1. Should I try with another version?

ElYaiko commented 7 months ago

Having same issue in MacOS:

Error: Cannot find module 'astrojs-compiler-sync'
Require stack:
- /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at Module._load (node:internal/modules/cjs/loader:927:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:4617:6454
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:1:266
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:5087:3691
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:1:266
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:5089:1813 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js'
  ]
}

Node.js v18.15.0
[Error - 8:26:10 PM] The vscode-graphql server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
Initialization failed
Pending response rejected since connection got disposed
Error: Pending response rejected since connection got disposed
darvids0n commented 7 months ago

I also have the same issue, but currently I can work around it by running npm install in the extension's folder:

cd ~/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/
npm install

Having same issue in MacOS:

Error: Cannot find module 'astrojs-compiler-sync'
Require stack:
- /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15)
    at Module._load (node:internal/modules/cjs/loader:927:27)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at Module.require (node:internal/modules/cjs/loader:1148:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:4617:6454
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:1:266
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:5087:3691
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:1:266
    at /Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js:5089:1813 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/yaiko/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/server/index.js'
  ]
}

Node.js v18.15.0
[Error - 8:26:10 PM] The vscode-graphql server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
Initialization failed
Pending response rejected since connection got disposed
Error: Pending response rejected since connection got disposed
M1CK431 commented 7 months ago

Confirmed this workaround to works from my side too. I use npm i --omit=dev, trying to save a bit space 😉 @acao perhaps it gives you some insights to fix this issue? 🤞🏼

ArmandPhilippot commented 7 months ago

Same issue here with Code OSS on Manjaro with v0.9.1:

Version: 1.85.1
Commit: Unknown
Date: 2023-12-14T20:02:29.406Z
Electron: 25.9.8
ElectronBuildId: undefined
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.10-1-MANJARO

I'm using Astro but without GraphQL. However I have both extensions enabled globally.

The strange thing is that the output of the Developer Tools (Help -> Toggle Developer Tools) is not exactly the same as the one in Output (which is the same as those already posted). In the Developer tools I don't see any mention of astrojs-compiler-sync. Here the details:

vscode-graphql client: couldn't create connection to server.
c   @   workbench.desktop.main.js:769

Then:

[GraphQL.vscode-graphql]Pending response rejected since connection got disposed
$onExtensionRuntimeError    @   workbench.desktop.main.js:2017

Then:

Error: Pending response rejected since connection got disposed
at Object.dispose (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:29:4460)
    at Object.dispose (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:22314)
    at Ll.handleConnectionClosed (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:12275)
    at Ll.handleConnectionClosed (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:50478)
    at t (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:11956)
    at ia.invoke (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:2:14331)
    at n.fire (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:2:15100)
    at Lt (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:3:6456)
    at ia.invoke (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:2:14331)
    at n.fire (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:2:15100)
    at Pa.fireClose (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:2:17355)
    at ChildProcess.<anonymous> (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:29:13076)
    at ChildProcess.emit (node:events:525:35)
    at ChildProcess.emit (node:domain:489:12)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)

Then:

[GraphQL.vscode-graphql]Client is not running and can't be stopped. It's current state is: starting
$onExtensionRuntimeError    @   workbench.desktop.main.js:2017

Then:

Error: Client is not running and can't be stopped. It's current state is: starting
at Ll.shutdown (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:8615)
    at Ll.stop (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:8194)
    at Ll.stop (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:50088)
    at Ll.doInitialize (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:7732)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Ll.start (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:4599)
    at async xR (/home/armand/.vscode-oss/extensions/graphql.vscode-graphql-0.9.1-universal/out/extension.js:39:61849)
    at async u.n (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:140:6255)
    at async u.m (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:140:6218)
    at async u.l (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:140:5675)

Then the errors repeat themselves since the server cannot be restarted and finally I get:

The vscode-graphql server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
c   @   workbench.desktop.main.js:769
hlshen commented 7 months ago

https://github.com/graphql/graphiql/commit/98af53071bb27afc0afc82d66f539c1ac08315b3#diff-282a02f8ecaf263e63ceecdc0702ec641f159a3b9069ad12769816236f0f602e

I believe the "external" params is preventing astro from being installed.

acao commented 6 months ago

unfortunately, if we remove it from external then it doesn't seem to work for vsce or for vscode marketplace 😢 perhaps we can make seperate esbuilds for vsce and ovsx then... !

acao commented 6 months ago

if you're still experiencing this bug in the latest release of the vscode extension or the CLI, let's do a poll - please react to this comment with:

M1CK431 commented 6 months ago

Solved in #3547 🥳

acao commented 6 months ago

fantastic to hear, thanks for helping!

Csszabi98 commented 6 months ago

@M1CK431 Looks like the fixed version was not published to open vsx, there the latest version is still 0.9.2. https://open-vsx.org/extension/GraphQL/vscode-graphql

M1CK431 commented 6 months ago

@Csszabi98 That's true but your man is @acao , not me 😉 In the meantime, you can downlad/install it from here: https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql

acao commented 6 months ago

@Csszabi98 I think there is an issue with openvsx publishing again and I will check to restore this before the next release!

acao commented 6 months ago

i will keep this open until we can confirm there is a working release for Open VSX users

i also released a prerelease of 0.10 to openvsx manually, as i did for vscode marketplace. did those show up? huge improvements coming across the board!

acao commented 6 months ago

ok, so, i learned the hard way that the bundled extension approach for open vsx publishing that appears to fix this issue also does not support pre-release. due to this and another issue I have accidentally published 0.10.1 pre-release as 0.10.1 stable on open-vsx 😆. an accidental bonus, you'll be seeing a fix for this issue as well as many other bugfixes, i apologize if there are any bugs from this refactor that you see before marketplace users do, but we can get this all cleaned up in a few patch releases to both extensions.

unfortunately vsix extensions do not support full semver for pre-releases, so it's tricky to get them working with our release tooling, as it could cause many undesired version increments if we're not careful

acao commented 6 months ago

ok so, the bad news is that 0.10.1 turned out to be a not-good release for schema first users on manual testing because of some assumptions by the integration test suites that didn't pan out. i can't find a way to roll back on openvsx either. i will find a way to rectify this, but i hope to ideally have an 0.9.4 release if I can or an 0.10.2 release to fix this, without the rewrite that currently needs some more tweaking

acao commented 6 months ago

I have asked the eclipse foundation to delete the impacted versions from the registry until we can correct this! Emoji reacts might help boost it :)

https://github.com/EclipseFdn/open-vsx.org/issues/2428

if they aren't able to get back to me by monday, i will just jump the 0.10.x release for 0.11, and make 0.10.2 the fix for all open-vsx users with a matching repeat release for the marketplace just so we're back in sync

M1CK431 commented 5 months ago

I just add a 👍🏼 on the mentioned issue 😘

acao commented 5 months ago

ok! those versions are deleted. partially resolved. I will try to get you a 0.9.4 release to fix tomorrow, and we will keep trying til it does. probably high time i install vscodium and confirm it works myself 😂 0.9.x just fixes svelte and adds astro parsing, but i want to close this ticket once we have a release working on open vsx. 0.10.0 will be a major improvement but I need til next week to do more thorough manual testing