You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a bit of a complex setup, but in summay we trigger our front-end CI builds via CMake which in turn uses MSBuild on Windows. We recently upgraded to nx v19.4 (from ~v10) and we are now getting intermittent build failures. (Apologies in advance - I'm not super-familiar with nx.)
Before you read further, I'll caution you that this message and stack trace aren't quite what they seem, but the output messages look like this:
nx run appname:build:production
ERROR (1) when writing
EPERM: operation not permitted, rename '
When the code prints err.message to console.log at line 150, the text begins with "Error: " which MSBuild automatically interprets as a failure (I have verified this with a simple test app that prints "Error: This is not an error" - MSBuild flags it as having failed.)
So, while nx is doing the right thing by retrying, it is outputting an error message before it has truly failed, confusing the CI pipeline.
Expected Behavior
Since I'm far from an expert I'm open to suggestions on how to change this. Perhaps it should only output an error message if all the retries have failed. Perhaps there should be some verbosity control or env var which suppresses this message. Perhaps the message should be reformatted to strip "Error:" from the beginning.
At the very least if you could advise how to avoid this, that would be appreciated. For example, I see a recent addition of the environment variable NX_FORCE_REUSE_CACHED_GRAPH by @AgentEnder last month, but I'm not sure what all must be committed (beyond project-graph.json) in order for that to work.
GitHub Repo
No response
Steps to Reproduce
Since this is intermittent and part of a complex proprietary setup with CMake and MSBuild I don't think I can provide a repro case.
We are hanging back at nx 19.4 due to some bug reports we saw of projects not being recognized. The code in question though has not changed between 19.4 and the latest version.
The text was updated successfully, but these errors were encountered:
But Subcategory and Code are optional, and Category is Error or Warning (case insensitive). Origin is also optional. So the output message has to be carefully crafted to avoid being parsed as an Error by MSBuild. I tested the following format and it worked well:
nx : warning : Exception thrown when outputting project-graph.json: Error: EPERM: operation not permitted, rename...
MSBuild interpreted it as a warning rather than as an error, which feels appropriate if we want to output something for every retry, not just the final failing retry.
Current Behavior
We have a bit of a complex setup, but in summay we trigger our front-end CI builds via CMake which in turn uses MSBuild on Windows. We recently upgraded to nx v19.4 (from ~v10) and we are now getting intermittent build failures. (Apologies in advance - I'm not super-familiar with nx.)
Before you read further, I'll caution you that this message and stack trace aren't quite what they seem, but the output messages look like this:
I've traced the problem to nx-deps-cache.ts ( https://github.com/nrwl/nx/blob/master/packages/nx/src/project-graph/nx-deps-cache.ts ) around line 142:
` try {
writeJsonFile(tmpProjectGraphPath, projectGraph);
renameSync(tmpProjectGraphPath, nxProjectGraph);
https://github.com/nrwl/nx/blob/71653dcbfe01d29cc60355a7221ab1370d899b29/packages/nx/src/project-graph/nx-deps-cache.ts#L141C5-L159C6
When the code prints err.message to console.log at line 150, the text begins with "Error: " which MSBuild automatically interprets as a failure (I have verified this with a simple test app that prints "Error: This is not an error" - MSBuild flags it as having failed.)
So, while nx is doing the right thing by retrying, it is outputting an error message before it has truly failed, confusing the CI pipeline.
Expected Behavior
Since I'm far from an expert I'm open to suggestions on how to change this. Perhaps it should only output an error message if all the retries have failed. Perhaps there should be some verbosity control or env var which suppresses this message. Perhaps the message should be reformatted to strip "Error:" from the beginning.
At the very least if you could advise how to avoid this, that would be appreciated. For example, I see a recent addition of the environment variable NX_FORCE_REUSE_CACHED_GRAPH by @AgentEnder last month, but I'm not sure what all must be committed (beyond project-graph.json) in order for that to work.
GitHub Repo
No response
Steps to Reproduce
Since this is intermittent and part of a complex proprietary setup with CMake and MSBuild I don't think I can provide a repro case.
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
We are hanging back at nx 19.4 due to some bug reports we saw of projects not being recognized. The code in question though has not changed between 19.4 and the latest version.
The text was updated successfully, but these errors were encountered: