Open seloner opened 2 years ago
I can confirm I am also experiencing this issue.
I am also experience the same issue. There are two different errors on 2 different projects.
I believe the issue it which root folder you choose. If you choose the root folder of the monorepo in the project of vercel as root it works. But in a vercel project you can choose as root folder a subfolder . So the npx nx-ignore is running in the subfolder instead in top level.
I'm only seeing builds showing a false positive. They should be deployed due to a change but aren't. One reason could be that the project in question is labeled as a "library" but has a storybook deployment attached to it. This used to work, so not sure what changed. Edit Perhaps this line?
I'm also having this problem. I have a monorepo with Nx and 2 apps are deployed via Vercel.
I've added npx nx-ignore [app-name]
to each app and when I'm changing one of them (for instance 'backoffice' app) and push the code to branch I get this error message:
[14:14:40.471] Cloning github.com/jeniabrook/nx-monorepo-poc (Branch: update-shop-app, Commit: d2c701d)
[14:14:40.790] Cloning completed: 318.332ms
[14:14:40.790] Running "npx nx-ignore backoffice --verbose"
[14:15:02.147] ≫ Using Nx to determine if this project (backoffice) is affected by the commit...
[14:15:02.147] ≫ Running from /vercel/.npm/_npx/258/lib/node_modules/nx-ignore/src
[14:15:02.148]
[14:15:02.148] ≫ Validating base ref: af43bb12b0c659dcb710818588c4360c8d09d692
[14:15:02.148]
[14:15:02.152] fatal: bad object af43bb12b0c659dcb710818588c4360c8d09d692
[14:15:02.152]
[14:15:02.152] ≫ Invalid base ref passed: af43bb12b0c659dcb710818588c4360c8d09d692. Defaulting to HEAD^.
[14:15:02.152]
[14:15:02.152]
[14:15:02.152] ≫ Comparing HEAD^...HEAD
[14:15:02.153]
[14:15:02.261] ≫ Affected projects:
[14:15:02.261]
[14:15:02.261] 🛑 - Build cancelled since backoffice is not affected
[14:15:03.009] The Deployment has been canceled as a result of running the command defined in the "Ignored Build Step" setting.
As @seloner mentioned, I have subfolders for the apps, this is how Vercel is working with monorepos.
For instance:
Anyone found a solution for it ?
Try to cd out in the root folder when running npx nx-ignore
@seloner I've tried the following: cd ../.. && npx nx-ignore backoffice
.
Monorepo structure:
root
|
|---apps
|
|---backoffice
|
|---packages
Maybe the the command that I'm using is not correct.
fwiw, i think i fixed this problem by manually specifying the workspace root, which for some reason nx-ignore
was not figuring out, like so:
npx nx-ignore --root="$(dirname $(dirname $PWD))" --verbose @friends-library/evans
the double dirname
is to go up two levels (from where my app was). you could also try hardcoding /vercel/path0
as the root
Current Behavior
I make a change to a shared library our nx environment. The app with name connector uses that shared library. Locally npx nx-ignore connector returns that the build can proceed.
I commit my code to Gitlab and then Vercel starts to automatically build. I added in npx nx-ignore connector in the Vercel settings. However, when this script is triggered in the Vercel build it skips over it and says "The Deployment has been canceled as a result of running the command defined in the "Ignored Build Step" setting
Expected Behavior
I expect it to build because that app was affected as I could see that it was affected locally.
Environment
nx : 14.3.6 @nrwl/angular : Not Found @nrwl/cypress : 14.3.6 @nrwl/detox : Not Found @nrwl/devkit : 14.3.6 @nrwl/eslint-plugin-nx : 14.3.6 @nrwl/express : Not Found @nrwl/jest : 14.3.6 @nrwl/js : 14.3.6 @nrwl/linter : 14.3.6 @nrwl/nest : Not Found @nrwl/next : 14.3.6 @nrwl/node : 14.3.6 @nrwl/nx-cloud : Not Found @nrwl/nx-plugin : Not Found @nrwl/react : 14.3.6 @nrwl/react-native : Not Found @nrwl/schematics : Not Found @nrwl/storybook : 14.3.6 @nrwl/web : 14.3.6 @nrwl/workspace : 14.3.6 typescript : 4.7.4
Community plugins: @jscutlery/semver: 2.23.4