relay icon indicating copy to clipboard operation
relay copied to clipboard

LSP error in Relay GraphQL VSCode Extension

Open alex-statsig opened this issue 2 years ago • 38 comments

Updated to relay 14 and added the Relay GraphQL extension for VSCode. Upon trying to use features like Intellisense on hover, I see some errors logged to "Relay LSP Logs" output:

[DEBUG] request received Request { id: RequestId(I32(194)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(11), "line": Number(20)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/ScheduledRollupsDialog.tsx")})}) }
[DEBUG] lsp_method: textDocument/hover
[DEBUG] lsp_type: request
[DEBUG] Successfully parsed the definitions for a target GraphQL source
[DEBUG] position_span: 155:155
lsp_outcome: error
[DEBUG] lsp_error_message: get_schema: schema is missing (or not ready, yet) for the `default` project.
[DEBUG]    0ms lsp_message_processing_time

I assume my relay config must be set up correctly since relay-compiler works fine. My project is looked at ./console/, but I've added that root to the extension settings (until I did that I saw a different error about not finding a project).

The "Relay" output includes:

Searching for the relay-compiler starting at: /Users/alex/dev/statsig/console
Starting the Relay GraphQL extension...
Using relay binary: /Users/alex/dev/statsig/console/node_modules/relay-compiler/macos-arm64/relay
Starting the Relay Langauge Server with these options: {"options":{"cwd":"/Users/alex/dev/statsig/console"},"command":"/Users/alex/dev/statsig/console/node_modules/relay-compiler/macos-arm64/relay","args":["lsp","--output=debug"]}
Not starting the Relay Compiler. Please enable relay.autoStartCompiler in your settings if you want the compiler to start when you open your project.

alex-statsig avatar Jun 13 '22 22:06 alex-statsig

Thanks for the bug report @alex-statsig. Do you have any output logs before that? I'm particularly interested in output from when the LSP first starts.

Could you clarify exactly which extension settings you have set?

captbaritone avatar Jun 14 '22 19:06 captbaritone

The "Relay" output included above is the full output for that channel.

Here's the full output from "Relay LSP Logs":

[DEBUG] Initialized stdio transport layer
[DEBUG] < {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":52943,"clientInfo":{"name":"Visual Studio Code - Insiders","version":"1.68.0-insider"},"locale":"en-us","rootPath":"/Users/alex/dev/statsig","rootUri":"file:///Users/alex/dev/statsig","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false},"linkedEditingRange":{"dynamicRegistration":true}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"}}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/alex/dev/statsig","name":"statsig"}]}}
[DEBUG] > {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"codeActionProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":["(","\n",",","@"]},"definitionProvider":true,"hoverProvider":true,"referencesProvider":true,"textDocumentSync":1}}}
[DEBUG] < {"jsonrpc":"2.0","method":"initialized","params":{}}
[DEBUG] < {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts","languageId":"typescript","version":1,"text":"(redacted file with a graphql mutation)"}}}
[DEBUG] JSON-RPC handshake completed
[DEBUG] Running language server with config root "/Users/alex/dev/statsig/console"
[DEBUG] Creating lsp_state...
[DEBUG] Creating lsp_state created!
[DEBUG] Processing task "InboundMessage(Notification(Notification { method: \"textDocument/didOpen\", params: Object({\"textDocument\": Object({\"languageId\": String(\"typescript\"), \"text\": String(\"(redacted file with a graphql mutation)\"), \"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\"), \"version\": Number(1)})}) }))"
[DEBUG] notification received Notification { method: "textDocument/didOpen", params: Object({"textDocument": Object({"languageId": String("typescript"), "text": String("(redacted file with a graphql mutation)"), "uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"), "version": Number(1)})}) }
[DEBUG] lsp_method: textDocument/didOpen
[DEBUG] lsp_type: notification
[DEBUG] lsp_outcome: success
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Notification(Notification { method: "textDocument/didOpen", params: Object({"textDocument": Object({"languageId": String("typescript"), "text": String("(redacted file with a graphql mutation)"), "uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"), "version": Number(1)})}) })) completed in 0ms
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] Processing task "LSPState(ValidateSyncedSource(Url { scheme: \"file\", cannot_be_a_base: false, username: \"\", password: None, host: None, port: None, path: \"/Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\", query: None, fragment: None }))"
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task LSPState(ValidateSyncedSource(Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts", query: None, fragment: None })) completed in 1ms
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 1ms
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 0ms
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
[DEBUG] Initializing resources for LSP server
[DEBUG] > {"jsonrpc":"2.0","id":"window/showStatus","method":"window/showStatus","params":{"message":"Sending watchman query to get source files and possible saved state","shortMessage":"Relay: watchman...","type":2}}
[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``
thread 'tokio-runtime-worker' panicked at 'Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``', /Users/runner/work/relay/relay/compiler/crates/relay-lsp/src/server/lsp_state_resources.rs:90:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[DEBUG] < {"jsonrpc":"2.0","id":"window/showStatus","result":null}
[DEBUG] Processing task "InboundMessage(Response(Response { id: RequestId(String(\"window/showStatus\")), result: None, error: None }))"
[DEBUG] task InboundMessage(Response(Response { id: RequestId(String("window/showStatus")), result: None, error: None })) completed in 0ms
[DEBUG] < {"jsonrpc":"2.0","id":1,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(1)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(1)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(1)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:50 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":2,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(2)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(2)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(2)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":2,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":3,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(3)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(3)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(3)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":3,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":4,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"range":{"start":{"line":100,"character":18},"end":{"line":100,"character":18}},"context":{"diagnostics":[]}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(4)), method: \"textDocument/codeAction\", params: Object({\"context\": Object({\"diagnostics\": Array([])}), \"range\": Object({\"end\": Object({\"character\": Number(18), \"line\": Number(100)}), \"start\": Object({\"character\": Number(18), \"line\": Number(100)})}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(4)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/codeAction
[DEBUG] lsp_type: request
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: Request Canceled
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(4)), method: "textDocument/codeAction", params: Object({"context": Object({"diagnostics": Array([])}), "range": Object({"end": Object({"character": Number(18), "line": Number(100)}), "start": Object({"character": Number(18), "line": Number(100)})}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":4,"error":{"code":-32001,"message":"Request Canceled"}}
[Error - 1:34:51 PM] Request textDocument/codeAction failed.
  Message: Request Canceled
  Code: -32001 
[DEBUG] < {"jsonrpc":"2.0","id":5,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts"},"position":{"line":24,"character":5}}}
[DEBUG] Processing task "InboundMessage(Request(Request { id: RequestId(I32(5)), method: \"textDocument/hover\", params: Object({\"position\": Object({\"character\": Number(5), \"line\": Number(24)}), \"textDocument\": Object({\"uri\": String(\"file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts\")})}) }))"
[DEBUG] request received Request { id: RequestId(I32(5)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(5), "line": Number(24)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) }
[DEBUG] lsp_method: textDocument/hover
[DEBUG] lsp_type: request
[DEBUG] Successfully parsed the definitions for a target GraphQL source
[DEBUG] position_span: 378:378
[DEBUG] lsp_outcome: error
[DEBUG] lsp_error_message: get_schema: schema is missing (or not ready, yet) for the `default` project.
[DEBUG]    0ms lsp_message_processing_time
[DEBUG] task InboundMessage(Request(Request { id: RequestId(I32(5)), method: "textDocument/hover", params: Object({"position": Object({"character": Number(5), "line": Number(24)}), "textDocument": Object({"uri": String("file:///Users/alex/dev/statsig/console/client/components/console/pulse/useCreateScheduledCustomPulseQueryMutation.ts")})}) })) completed in 0ms
[DEBUG] > {"jsonrpc":"2.0","id":5,"error":{"code":-32001,"message":"get_schema: schema is missing (or not ready, yet) for the `default` project."}}
[Error - 1:34:52 PM] Request textDocument/hover failed.
  Message: get_schema: schema is missing (or not ready, yet) for the `default` project.
  Code: -32001 

alex-statsig avatar Jun 14 '22 20:06 alex-statsig

Getting similar LSP error with the extension

[Error - 12:45:03 PM] Connection to server got closed. Server will not be restarted.
thread 'main' panicked at 'failed to execute process. Make sure you have Node installed.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/runner/work/relay/relay/compiler/crates/js-config-loader/src/loader.rs:68:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

raghav-mylagary avatar Jun 21 '22 23:06 raghav-mylagary

I also get the 'Make sure you have Node installed' exception. It doesn't look like node is on the path when the compiler is being spun up. I can run it if i type node to start it, then ctrl-c out and then manually spin up the compiler in watch mode, however, I still dont see any difference. Im using eslint relay, would that cause issues?

tmitchel2 avatar Jun 22 '22 10:06 tmitchel2

@raghavyadavm @tmitchel2 This is pretty interesting. It seems like whatever shell VSCode is using to spin up these processes is not the shell you use in your terminal (where you have node configured).

I'm assuming you're using nvm? Could you tell me where you're configuring your shell to have node in your path? This might give me some insight into how to fix your issue.

tbezman avatar Jun 26 '22 02:06 tbezman

@alex-statsig Do you think it would be possible to create a minimum repro repo so I could take a look and inspect further?

tbezman avatar Jun 26 '22 02:06 tbezman

@raghavyadavm @tmitchel2 This is pretty interesting. It seems like whatever shell VSCode is using to spin up these processes is not the shell you use in your terminal (where you have node configured).

I'm assuming you're using nvm? Could you tell me where you're configuring your shell to have node in your path? This might give me some insight into how to fix your issue.

Yes, I am using nvm to manage the node. The path for the node goes to the nvm directory

which node
/Users/name/.nvm/versions/node/v16.10.0/bin/node

nvm settings

export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion

raghav-mylagary avatar Jun 26 '22 22:06 raghav-mylagary

@raghavyadavm which file is that configuration in? ~/.zshrc, ~/.bashrc, ~/.bash_profile?

tbezman avatar Jun 28 '22 20:06 tbezman

@raghavyadavm which file is that configuration in? ~/.zshrc, ~/.bashrc, ~/.bash_profile?

Zshrc

raghav-mylagary avatar Jun 28 '22 21:06 raghav-mylagary

@raghavyadavm hmm, I wonder if it would work if you put the nvm stuff in your bashrc

tbezman avatar Jun 30 '22 07:06 tbezman

@alex-statsig Do you think it would be possible to create a minimum repro repo so I could take a look and inspect further?

@tbezman Yeah, here's a minimal reproduction: https://github.com/statsig-io/relay-vscode-repro

Seems to hit the exact same issue of "get_schema: schema is missing (or not ready, yet) for the default project.". I'm sure the repro could probably be made smaller but just copied some of the core frameworks for simplicity.

Let me know if you have any issues with this. It uses pnpm to manage packages.

alex-statsig avatar Jul 03 '22 16:07 alex-statsig

cc @tbezman any update on this? Thanks

alex-statsig avatar Jul 14 '22 17:07 alex-statsig

@alex-statsig hmmm, just pulled down your repo (used pnpm) and things worked like fine. I'll try to dig deeper. @captbaritone do you have any ideas?

I'll try to do a bit of digging

tbezman avatar Jul 15 '22 05:07 tbezman

@raghavyadavm any update on your issue?

tbezman avatar Jul 15 '22 05:07 tbezman

@alex-statsig This line from your logs seems sus

[DEBUG] error: Watchman error: While invoking the watchman CLI to discover the server connection details: No such file or directory (os error 2), stderr=``

Maybe you and @raghavyadavm have the same root cause issue. I'm thinking VSCode's default shell isn't using the shell where you add your watchman binary to the path. For @raghavyadavm I think it's not finding his node binary in the path.

tbezman avatar Jul 15 '22 05:07 tbezman

This seems very inline with what I'm thinking https://github.com/microsoft/vscode-languageserver-node/issues/358 . Looks like the process started by VSCode does not inherit your shell environment by default.

tbezman avatar Jul 15 '22 05:07 tbezman

@alex-statsig @raghavyadavm Would you mind trying out this PR? https://github.com/facebook/relay/pull/4012

  1. Clone my PR
  2. cd compiler && cargo build
  3. There should be a file at compiler/target/debug/relay (you'll need an absolute path to this file later)
  4. cd back to the root of the repo
  5. cd vscode-extension
  6. yarn install
  7. code . to open the vscode extension directory in vscode
  8. Press F5 to run the extension.
  9. Open the VSCode settings json and set (relay.pathToRelay to the absolute path to the relay binary from earlier)
  10. Cmd+Shift+P => Reload Window
  11. See if the problem persists.

tbezman avatar Jul 15 '22 05:07 tbezman

@alex-statsig @raghavyadavm Would you mind trying out this PR? #4012

  1. Clone my PR
  2. cd compiler && cargo build
  3. There should be a file at compiler/target/debug/relay (you'll need an absolute path to this file later)
  4. cd back to the root of the repo
  5. cd vscode-extension
  6. yarn install
  7. code . to open the vscode extension directory in vscode
  8. Press F5 to run the extension.
  9. Open the VSCode settings json and set (relay.pathToRelay to the absolute path to the relay binary from earlier)
  10. Cmd+Shift+P => Reload Window
  11. See if the problem persists.

Ah I didn't have watchman installed before, running "brew install watchman" seems to have resolved the issue. I'm not sure if I'm supposed to need to install it. Would you still want me to try out this PR as a fix without watchman installed?

alex-statsig avatar Jul 16 '22 06:07 alex-statsig

@alex-statsig nah I think you're good with just installing watchman.

tbezman avatar Jul 16 '22 09:07 tbezman

@alex-statsig nah I think you're good with just installing watchman.

Apologies, and thanks for the help debugging. Is that intentional (and just not documented clearly) or will future versions not require it?

alex-statsig avatar Jul 16 '22 16:07 alex-statsig

hmmm, yeah I think the only page on the docs site that mentions watchman is here.

tbezman avatar Jul 22 '22 16:07 tbezman

hmmm, yeah I think the only page on the docs site that mentions watchman is here.

Yeah, and that seems to be only if using "--watch" (which I didn't turn on the setting for in the extension). I've had no issues generally compiling relay without it

alex-statsig avatar Jul 26 '22 17:07 alex-statsig

@petrbela would you mind trying this out? https://github.com/facebook/relay/issues/3975#issuecomment-1185191285

tbezman avatar Aug 09 '22 15:08 tbezman

@tbezman Tried that, no change. nvm is loaded in bashrc. Also, not sure if it's relevant, if I downgrade to Relay 13, I get [ERROR] Failed to read config file 'lsp'.

petrbela avatar Aug 09 '22 17:08 petrbela

@petrbela yeah , relay 13 didn't support the lsp yet. hmmm im running out of ideas here. i'm not sure how to get the extension to recognize where the node binary is

tbezman avatar Aug 09 '22 21:08 tbezman

really wish it didn't work on my machine haha

tbezman avatar Aug 09 '22 21:08 tbezman

In a surprising twist of events, I restarted VSCode (and updated to 1.70) and got this error alongside the Relay failed to start one. Then, after quitting and starting a new instance using code ., the Relay extension started working. Not sure if the shell initialization was causing the problem before or if there's some other pattern at play but I'll report back if it stops working again.

petrbela avatar Aug 10 '22 07:08 petrbela

@petrbela so is the takeaway that the shell thing worked right now?

tbezman avatar Aug 10 '22 20:08 tbezman

@tbezman no, I'm using the production version of the extension. Seems like it was something with VSCode environment initialization but it's working now even after restarts so can't confirm for sure.

petrbela avatar Aug 10 '22 22:08 petrbela

@petrbela i wonder if it's different based on whether or not you started VS Code from the cli or not

tbezman avatar Aug 11 '22 00:08 tbezman