question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NX Cloud seems to be incorrectly restoring from cache

See original GitHub issue

Current Behavior

We are seeing nx and nx cloud restoring from cache incorrectly during nx build.

Expected Behavior

What should be triggering a new build is restoring from cache and new changes are not being included. This seems to be a regression in new versions of nx and nx cloud (I haven’t been able to pin point when this was introduced).

Steps to Reproduce

The git commits to pass to nx are determined by the environment variable $COMMIT_SHA which is an environment variable for the current commit being built (google cloud build).

        # write the git revisions for the nx affected git comparison
        echo $COMMIT_SHA > HEAD
        echo $(git rev-parse $COMMIT_SHA~1) > BASE

Note, that we have had several reports of team members encountering this same issue (with different commits of course).

The change that I build this morning was a simple one line change. This is a git hub diff of the same commits that were used for the nx build. image

npx nx affected:build --base=2d21bb4f635c7c7cda098996416a5ad838629a1f --head=6449eccf47322168812232b5a5e2547ca40636e1 --with-deps --prod --parallel

NX restored from cache incorrectly, as the above changes were not included in the cache restore: image

Environment

   Node : 14.18.3
   OS   : darwin x64
   npm  : 6.14.15

   nx : undefined
   @nrwl/angular : 13.7.1
   @nrwl/cli : 13.7.1
   @nrwl/cypress : 13.7.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.7.1
   @nrwl/eslint-plugin-nx : 13.7.1
   @nrwl/express : undefined
   @nrwl/jest : 13.7.1
   @nrwl/js : undefined
   @nrwl/linter : 13.7.1
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : undefined
   @nrwl/nx-cloud : 13.1.2
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : 8.12.11
   @nrwl/storybook : 13.7.1
   @nrwl/tao : 13.7.1
   @nrwl/web : undefined
   @nrwl/workspace : 13.7.1
   typescript : 4.5.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
   	 @angular-devkit/architect: 0.1302.0
   	 @angular/animations: 13.2.0
   	 @angular/cdk: 13.2.0
   	 @angular/common: 13.2.0
   	 @angular/compiler: 13.2.0
   	 @angular/core: 13.2.0
   	 @angular/elements: 13.2.0
   	 @angular/fire: 6.1.4
   	 @angular/forms: 13.2.0
   	 @angular/localize: 13.2.0
   	 @angular/material: 13.2.0
   	 @angular/material-moment-adapter: 13.2.0
   	 @angular/platform-browser: 13.2.0
   	 @angular/platform-browser-dynamic: 13.2.0
   	 @angular/router: 13.2.0
   	 @angular/service-worker: 13.2.0
   	 @ngrx/effects: 13.0.1
   	 @ngrx/store: 13.0.1
   	 @ngrx/store-devtools: 13.0.1
   	 angular-calendar: 0.28.26
   	 ngx-bootstrap: 6.2.0
   	 @angular-builders/custom-webpack: 13.0.0
   	 @angular-devkit/build-angular: 13.2.0
   	 @angular/cli: 13.2.0
   	 @angular/compiler-cli: 13.2.0
   	 @angular/language-service: 13.2.0
   	 @ngneat/spectator: 6.1.3
   	 @testing-library/angular: 10.11.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:17

github_iconTop GitHub Comments

3reactions
jimhesscommented, Jun 16, 2022

Experiencing the same problem. It mis-computing the hash returning nx cloud results for the wrong build / SHA.

How do we re-open?

1reaction
jredl-vacommented, Feb 26, 2022

@FrozenPandaz apologies for the delayed response (vacation).

This is incredibly hard to reproduce as its inconsistent and only seen within our ci environment. I feel that something within 13.7.0 or 13.7.1 changed how a cache hit is determined and as a result nx incorrectly returns a cached build when it should be triggering a new build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Cache Misses
Troubleshoot Cache Misses. Problem: A task is being executed when you expect it to be replayed from the cache. Check if the output...
Read more >
How to clear Nx cache
Just delete the whole 'nx' cache folder: rm -rf ./node_modules/.cache/nx.
Read more >
Troubleshoot issues with CloudFront custom object caching
If your CloudFront distribution isn't caching based on the custom values that you set on cache behaviors, then check the origin. Verify whether...
Read more >
Troubleshoot Common L2L and Remote Access IPsec ...
If the ping is sourced incorrectly, it can appear that the VPN connection has ... no sysopt uauth allow-http-cache no sysopt connection permit-ipsec...
Read more >
NX 1899 Release Notes
modeling to read point clouds and combine facet bodies. ... To remedy this problem, you can reset the size of the Java heap...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found