nx icon indicating copy to clipboard operation
nx copied to clipboard

Project Crystal: AggregateCreateNodesError with version 19.3.0

Open a88zach opened this issue 1 year ago • 4 comments

Current Behavior

When generating a project graph with version 19.3.0, the following error occurs

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  AggregateCreateNodesError: Failed to create nodes
      at LoadedNxPlugin.createNodes.<computed> (/Users/zachtindall/Documents/repos/crystal-bug/node_modules/nx/src/project-graph/plugins/internal-api.js:48:27)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async createNodes (/Users/zachtindall/Documents/repos/crystal-bug/node_modules/nx/src/project-graph/plugins/isolation/plugin-worker.js:47:32)
      at async consumeMessage (/Users/zachtindall/Documents/repos/crystal-bug/node_modules/nx/src/project-graph/plugins/isolation/messaging.js:34:26)

Expected Behavior

The project graph should be created successfully when using project crystal plugins

GitHub Repo

https://github.com/a88zach/crystal-bug

Steps to Reproduce

  1. install dependencies
  2. run yarn exec nx show project test-lib-1 --verbose

Nx Report

Cannot run due to error processing project graph

~/Documents/repos/crystal-bug - (main) > yarn exec nx report --verbose

 NX   Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.


"@nx/eslint": "19.3.0",
    "@nx/eslint-plugin": "19.3.0",
    "@nx/jest": "19.3.0",
    "@nx/js": "19.3.0",
    "@nx/node": "19.3.0",
    "@nx/react": "19.3.0",
    "@nx/vite": "19.3.0",
    "@nx/web": "19.3.0",
    "@nx/workspace": "19.3.0",
    "nx": "19.3.0",

Failure Logs

No response

Package Manager Version

yarn 3.8.2

Operating System

  • [X] macOS
  • [ ] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

No response

a88zach avatar Jun 14 '24 15:06 a88zach

This happens with and without custom plugins listed in the nx.json

a88zach avatar Jun 14 '24 15:06 a88zach

@AgentEnder, any thoughts on a workaround to this one?

a88zach avatar Jun 18 '24 16:06 a88zach

Same with 19.3.1. Updated the repo with the latest version

a88zach avatar Jun 24 '24 14:06 a88zach

Turns out that the options object is now required (or the plugins are not checking for it's existence before accessing it's properties). Adding an empty options object to each plugin in nx.json fixes the issue

{
      "plugin": "@nx/eslint/plugin",
      "include": ["apps/**/*", "libs/**/*"],
      "options": {}
}

This is likely the issue in the eslint plugin: https://github.com/nrwl/nx/blob/master/packages/eslint/src/plugins/plugin.ts#L503

Not sure if this is an issue yet in other plugins

a88zach avatar Jun 27 '24 15:06 a88zach

This has been fixed, in the future if a similar error arises it will also have a nicer error message.

AgentEnder avatar Jul 25 '24 21:07 AgentEnder

@AgentEnder, I have a workaround, but the root cause here as described a few comments up is still not fixed.

The plugins schema does not require an options object, but the nx plugins (at least the eslint plugin) is not allowing an undefined options object

https://github.com/nrwl/nx/blob/master/packages/eslint/src/plugins/plugin.ts#L517

Does not check to see if options is undefined before accessing targetName

a88zach avatar Jul 26 '24 13:07 a88zach

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Aug 26 '24 00:08 github-actions[bot]