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

affected: commands break in 8.10.0 #2274

Closed
b-johnse opened this issue Jan 6, 2020 · 24 comments
Closed

affected: commands break in 8.10.0 #2274

b-johnse opened this issue Jan 6, 2020 · 24 comments
Assignees
Labels

Comments

@b-johnse
Copy link

b-johnse commented Jan 6, 2020

Expected Behavior

Updating from 8.9.0 to 8.10.0 to have no breaking changes and scripts execute same as before without modification, or to receive a meaningful error message.

Current Behavior

Any commands for affected files ( affected:test, affected:lint, affected:apps) now produce an identical error after updating to latest

Failure Information (for bugs)

> nx affected:test

...\node_modules\@nrwl\workspace\node_modules\yargs\yargs.js:1109
      else throw err
           ^

TypeError: Cannot read property 'name' of undefined
    at ProjectGraphBuilder.addNode (...\node_modules\@nrwl\workspace\src\core\project-graph\project-graph-builder.js:15:25)
    at addAffectedNodes (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:39:13)
    at ...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:33:9
    at Array.forEach (<anonymous>)
    at filterAffectedProjects (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:32:25)
    at Object.filterAffected (...\node_modules\@nrwl\workspace\src\core\affected-project-graph\affected-project-graph.js:21:12)
    at Object.affected (...\node_modules\@nrwl\workspace\src\command-line\affected.js:19:36)
    at Object.handler (...\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:66:138)
    at Object.runCommand (...\node_modules\@nrwl\workspace\node_modules\yargs\lib\command.js:235:44)
    at Object.parseArgs [as _parseArgs] (...\node_modules\@nrwl\workspace\node_modules\yargs\yargs.js:1022:30)

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. run ng update @nrwl/workspace to go from 8.9.0 to 8.10.0
  2. from feature branch run nx affected:test and receive error

Context

Please provide any relevant information about your setup:

  • Nx 8.10.0
  • Angular 8.2.14
  • npm 6.13.1
  • node 13.3.0
@Cammisuli Cammisuli added scope: core core nx functionality type: bug labels Jan 6, 2020
@alfaproject
Copy link
Contributor

I get maximum call stack exceeded:

yarn run v1.21.1
$ nx affected:lint
/.../node_modules/yargs/yargs.js:1133
      else throw err
           ^

RangeError: Maximum call stack size exceeded
    at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:20
    at Array.forEach (<anonymous>)
    at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
    at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
    at Array.forEach (<anonymous>)
    at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
    at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
    at Array.forEach (<anonymous>)
    at addAffectedNodes (/.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:12)
    at /.../node_modules/@nrwl/workspace/src/core/affected-project-graph/affected-project-graph.js:42:36
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@CRACKISH
Copy link

CRACKISH commented Jan 8, 2020

I have same error

@zaverden
Copy link

zaverden commented Jan 8, 2020

In 8.11.0 the error has been improved. Now it says Invalid project name is detected: moment

0c7a9d3#diff-3d7fd504c78c121f5722de1bedbc0deeR74

@zaverden
Copy link

zaverden commented Jan 8, 2020

repo to reproduce - https://github.com/zaverden/nx-affected-error/tree/affected-error

  1. clone
  2. switch to affected-error branch
  3. run any affected command, for example yarn affected:apps

Steps:

  1. create ws
  2. add some dependency, for example moment
  3. commit to master
  4. start new branch
  5. remove the dependency
  6. drop dist folder (to remove nxdeps cache)
  7. run affected command

The source of a problem: getTouchedNpmPackages returns removed packages as touched, but createProjectGraph includes only actual nodes[type='npm']

@zaverden
Copy link

zaverden commented Jan 8, 2020

@alfaproject try 8.11.0. Looks like commit 0c7a9d3 solves call stack issue.

@raheelriax
Copy link

I am also facing the same issue when I run affected:lint against my origin/develop. I did some digging and found out that's because I've removed a dependency from my package.json and origin/develop still has it listed in his dependencies, this should not break the affected command.
So the question is what should be the right action if someone has a dependency mismatch?

I am happy to work on this issue if someone can tell me what should be the expected action

I am using

@nrwl/angular : Not Found
@nrwl/cli : 8.11.0
@nrwl/cypress : 8.11.0
@nrwl/eslint-plugin-nx : 8.11.0
@nrwl/express : 8.11.0
@nrwl/jest : 8.10.1
@nrwl/linter : 8.11.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 8.11.0
@nrwl/react : 8.11.0
@nrwl/schematics : Not Found
@nrwl/tao : 8.11.0
@nrwl/web : 8.11.0
@nrwl/workspace : 8.11.0
typescript : 3.5.3

@alfaproject
Copy link
Contributor

@zaverden it's true that there is no call stack exception anymore but now the affected commands don't seem to finish. Infinite loop it seems, so still unusable. ):

@Timebutt
Copy link

Timebutt commented Jan 10, 2020

@raheelriax: interesting find: the same is valid for my case. I am seeing:

Invalid project name is detected: "@angular/http"

and indeed: master has that @angular/http as a dependency in package.json, whereas my branch removed that. I'm also on 8.11.0. I'm not really sure if I can be of help to solve this issue (will dig into code to see how it works), but can gladly help reproduce or verify the issue to help facilitate a fix!

@zaverden
Copy link

@raheelriax problem will be solved if getTouchedNpmPackages stops returns packages which were removed.

JsonChange has a type field so you can check it.

Link to getTouchedNpmPackages: https://github.com/nrwl/nx/blob/e41b448085/packages/workspace/src/core/affected-project-graph/locators/npm-packages.ts#L17

I don't know what side effects this change can bring. But at least this is a good starting point

@raheelriax
Copy link

@zaverden same here 😕 , I also used a workaround on my local machine to get it to working but I am not sure about the expected actions or what it should actually do in these kind of scenarios.
Waiting for anyone from the Nx team or contributors to shed a light on this.

@puku0x
Copy link
Contributor

puku0x commented Jan 10, 2020

@zaverden I'm facing the same issue.

@Tre665
Copy link

Tre665 commented Jan 10, 2020

Can also confirm this bug:

For me works on my local machine (mac os 10.15) but breaks on our CI which uses ubuntu (but tried a run witch mac os which also breaks) with the error message:

Error: Invalid project name is detected: "time-ago-pipe"

where the package time-ago-pipe was removed

@zaverden
Copy link

@Tre665 it works locally for you, because nx uses cache. It is located in dist folder.

Wild thought: if you commit your local dist/nxdeps.json file it'll be used on your CI machine. So, it may be a work around for you

@raheelriax
Copy link

@Tre665 for me its breaking on both CI and on my local machine (Mac OS X 10.15.2)

@JoepKockelkorn
Copy link

I'm also running into this bug after removing some dependencies. Removing the dist/ folder locally doesn't fix it. Output of yarn nx affected:build is: Error: Invalid project name is detected: "@ngx-translate/core". Seems to me that when no nx cache is found, the package.json is compared but still (wrongly) complains about a removed dependency.

@jaysoo jaysoo self-assigned this Jan 13, 2020
@jaysoo
Copy link
Member

jaysoo commented Jan 13, 2020

I'll take a look. It will be patched in the next release.

jaysoo added a commit to jaysoo/nx that referenced this issue Jan 13, 2020
@jaunkst
Copy link

jaunkst commented Jan 14, 2020

@jaysoo Any estimate on when we can expect a release with this fix? This is halting our CICD pipeline.

jaysoo added a commit to jaysoo/nx that referenced this issue Jan 15, 2020
@kkuriata
Copy link

@jaysoo @vsavkin Exactly the same problem as @jaunkst. CI is dead for now, because of that issue. Please, create a new release.

@Tre665
Copy link

Tre665 commented Jan 15, 2020

@kkuriata We are also facing the issue. As a temporary workaround we just re-added the package to keep them in sync with master and manage a list which dependency we have to remove when the fix is released.
It is not the best way, but at least our CI keeps working.

@kkuriata
Copy link

@Tre665 Yeah, I was thinking about that, too :)

@jaunkst
Copy link

jaunkst commented Jan 15, 2020

8.11.1 was released and an upgrade resolved the CICD issues.

@kkuriata
Copy link

Thanks guys for resolving this issue so fast!

@ChenReuven
Copy link

This issue still happens in NX 10.3.0 version

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests