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

textDocument/documentLink fails with: Cannot use 'in' operator to search for 'x-completion-type' in string #2050

Open
1 of 4 tasks
onordbo opened this issue Mar 11, 2024 · 2 comments
Labels
type: bug Something isn't working

Comments

@onordbo
Copy link

onordbo commented Mar 11, 2024

Current Behavior

Hi! (reposting this from Discord at the request of @MaxKless). Lately I've seen this error from the Nx Console Extension a lot: Request textDocument/documentLink failed. I'm not exactly sure what is going on but the popup is becoming quite the nuisance. It seems to happen whenever I save changes to any file in my project.

VS Code Error

image

Expected Behavior

No errors thrown after saving file changes within my workspace.

GitHub Repo

No response

Steps to Reproduce

I'm not well versed enough in debugging monorepos to create a detailed reproduction guide, but this error seemingly occurs whenever I edit any file within my workspace. Hopefully the provided logs provide some context.

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 21.1.0
   OS     : darwin-arm64
   pnpm   : 8.15.1
   
   nx (global)        : 18.0.4
   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/esbuild        : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nx/node           : 18.0.4
   @nx/plugin         : 18.0.4
   @nx/rollup         : 18.0.4
   typescript         : 5.3.3

Failure Logs

[Nxls] - 2024-03-06T13:47:09.807Z - Retrieving workspace configuration
[Nxls] - 2024-03-06T13:47:09.907Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/file-utils.js
[Nxls] - 2024-03-06T13:47:09.907Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/project-graph.js
[Nxls] - 2024-03-06T13:47:09.907Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/utils/output.js
[Nxls] - 2024-03-06T13:47:09.908Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/file-map-utils.js
[Nxls] - 2024-03-06T13:47:09.908Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/daemon/client/client.js
[Nxls] - 2024-03-06T13:47:09.909Z - createProjectGraphAndSourceMapsAsync
[Nxls] - 2024-03-06T13:47:10.050Z - createProjectGraphAndSourceMapsAsync successful
[Nxls] - 2024-03-06T13:47:10.062Z - Resetting daemon client
[Nxls] - 2024-03-06T13:47:10.062Z - Retrieved workspace configuration in: 255.39258408546448 ms
[Error - 2:47:10 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot use 'in' operator to search for 'x-completion-type' in string
  Code: -32603 
[Error - 2:48:24 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot use 'in' operator to search for 'x-completion-type' in string
  Code: -32603 
[Nxls] - 2024-03-06T13:48:29.509Z - Project configuration changed
[Nxls] - 2024-03-06T13:48:30.510Z - Retrieving workspace configuration
[Nxls] - 2024-03-06T13:48:30.511Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/file-utils.js
[Nxls] - 2024-03-06T13:48:30.511Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/project-graph.js
[Nxls] - 2024-03-06T13:48:30.511Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/daemon/client/client.js
[Nxls] - 2024-03-06T13:48:30.511Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/utils/output.js
[Nxls] - 2024-03-06T13:48:30.511Z - Using local Nx package at /redacted/path/to/my/integrated/nx/monorepo/node_modules/nx/src/project-graph/file-map-utils.js
[Nxls] - 2024-03-06T13:48:30.511Z - createProjectGraphAndSourceMapsAsync
[Nxls] - 2024-03-06T13:48:30.546Z - createProjectGraphAndSourceMapsAsync successful
[Nxls] - 2024-03-06T13:48:30.550Z - Resetting daemon client
[Nxls] - 2024-03-06T13:48:30.550Z - Retrieved workspace configuration in: 39.30800008773804 ms
[Error - 2:48:30 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot use 'in' operator to search for 'x-completion-type' in string
  Code: -32603 
[Error - 2:51:14 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot use 'in' operator to search for 'x-completion-type' in string
  Code: -32603 
[Error - 2:54:03 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot use 'in' operator to search for 'x-completion-type' in string
  Code: -32603

Package Manager Version

8.15.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@onordbo onordbo added the type: bug Something isn't working label Mar 11, 2024
@MaxKless MaxKless transferred this issue from nrwl/nx Mar 11, 2024
@MaxKless
Copy link
Collaborator

to me this smells like something funky is happening in one of your project.json definitions. In webstorm, can you run the Analyze Nx Configuration Files action?
We should handle this error better for sure but I don't think this happens on repos with proper syntax.
Would be amazing if you could provide a reproduction so I can track it down...

@MaxKless MaxKless added the blocked: more info needed more info needed label Apr 2, 2024
@MaxKless MaxKless changed the title NX Console fails to read project graph textDocument/documentLink fails with: Cannot use 'in' operator to search for 'x-completion-type' in string Apr 2, 2024
@onordbo
Copy link
Author

onordbo commented May 7, 2024

I tried looking for the action you mentioned, but I couldn't find it (at least not in VS Code). You were right though. After some debugging I discovered that the error is only occurring within some of my project.json configurations.

I have located the offending target (which triggers an executor in custom local plugin). However, nothing looks out of the ordinary—and it runs exactly as expected when I invoke it. Unfortunately, I can't share the actual source code as it's protected IP. However, I can provide an anonymized example of what it looks like:

Target

{
  // ...
  "offending-target": {
    "dependsOn": ["another-target"],
    "executor": "@my-org/my-plugin:my-executor",
    "options": {
      "inputPath": "path/to/directory/with/things",
      "outputPath": "path/to/directory/"
    }
  },
  // ...
}

Executor Schema (json)

{
  "$schema": "https://json-schema.org/schema",
  "version": 2,
  "title": "MyFunction executor",
  "description": "",
  "type": "object",
  "properties": {
    "inputPath": "string",
    "outputPath": "string"
  },
  "required": ["inputPath", "outputPath"]
}

@MaxKless MaxKless removed the blocked: more info needed more info needed label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants