nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.58k stars 2.36k forks source link

namedInputs can not have lines that starts with `!{workspaceRoot}` in 17.2 #20677

Closed e-oz closed 10 months ago

e-oz commented 11 months ago

Current Behavior

nx.json

{
  "namedInputs": {
    "without_tests": [
      "!{projectRoot}/**/?(*.)+(spec|test|pw).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/jest.config.[jt]s",
      "!{workspaceRoot}/jest.preset.js",
      "!{workspaceRoot}/jest.config.ts"
    ]
  }
}
Error: !{workspaceRoot}/playwright.*.ts does not start with {workspaceRoot}/
    at NativeTaskHasherImpl.hashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/hasher/native-task-hasher-impl.js:33:36)
    at InProcessTaskHasher.hashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/hasher/task-hasher.js:53:50)
    at handleHashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/handle-hash-tasks.js:20:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleResult (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:110:16)
    at async handleMessage (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:84:9)
    at async /Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:45:9 {
  code: 'GenericFailure'
}

Expected Behavior

Was working fine in 17.1.3

GitHub Repo

No response

Steps to Reproduce

nx.json

{
  "namedInputs": {
    "without_tests": [
      "!{projectRoot}/**/?(*.)+(spec|test|pw).[jt]s?(x)?(.snap)",
      "!{projectRoot}/tsconfig.spec.json",
      "!{projectRoot}/jest.config.[jt]s",
      "!{workspaceRoot}/jest.preset.js",
      "!{workspaceRoot}/jest.config.ts"
    ]
  }
}

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 21.4.0
   OS     : darwin-arm64
   yarn   : 1.22.21

   nx                 : 17.2.0
   @nx/js             : 17.2.0
   @nx/jest           : 17.2.0
   @nx/linter         : 17.2.0
   @nx/eslint         : 17.2.0
   @nx/workspace      : 17.2.0
   @nx/angular        : 17.2.0
   @nx/cypress        : 17.2.0
   @nx/devkit         : 17.2.0
   @nx/eslint-plugin  : 17.2.0
   @nx/storybook      : 17.2.0
   @nrwl/tao          : 17.2.0
   @nx/web            : 17.2.0
   @nx/webpack        : 17.2.0
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   @jefiozie/ngx-aws-deploy   : 5.1.0
   @ng-bootstrap/ng-bootstrap : 16.0.0
   @ngrx/component-store      : 17.0.1
   @ngrx/data                 : 17.0.1
   @ngrx/effects              : 17.0.1
   @ngrx/entity               : 17.0.1
   @ngrx/store                : 17.0.1
   @ngrx/store-devtools       : 17.0.1
   @storybook/angular         : 7.6.4
   @testing-library/angular   : 15.1.0

Failure Logs

Error: !{workspaceRoot}/playwright.*.ts does not start with {workspaceRoot}/
    at NativeTaskHasherImpl.hashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/hasher/native-task-hasher-impl.js:33:36)
    at InProcessTaskHasher.hashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/hasher/task-hasher.js:53:50)
    at handleHashTasks (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/handle-hash-tasks.js:20:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleResult (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:110:16)
    at async handleMessage (/Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:84:9)
    at async /Users/oz/repos/scs/scs-workspace/node_modules/nx/src/daemon/server/server.js:45:9 {
  code: 'GenericFailure'
}

Package Manager Version

No response

Operating System

Additional Information

No response

jaysoo commented 11 months ago

@e-oz Thanks for reporting, can you try setting NX_NATIVE_TASK_HASHER=false and see if that helps?

Cammisuli commented 10 months ago

For context, {workspaceRoot} inputs are inclusive only. Having a negative one will do nothing.

In the previous version of the hasher, these kinds of inputs were mistakenly hashed, and the resulting hash was basically an empty string. The new hasher now will throw an error, but that was a mistake, and should show a warning instead. In the future this will throw a error though.

github-actions[bot] commented 9 months ago

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.