-
Notifications
You must be signed in to change notification settings - Fork 522
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
change in run_node behaviour from 4.4.1 to 4.4.2 #3054
Comments
the line that breaks this build is here: https://github.com/bazelbuild/rules_nodejs/blob/5ac721a21ad151571bb78f5fd7221aeaa7522c61/internal/linker/index.js#L342 |
Thanks for the detailed report. I took a look at your repro & your fix in #3058. The problem seems to be that after the refactor, the linker is now creating a In short, in 4.4.2 there is now node_modules symlinked at,
while in 4.4.1 this wasn't created. The error for the nextjs build AFAICT is that it is resolving react to the two different node_modules trees in the build which is breaks the react build. React requires a single version at a single node_modules location. I've seen the error produced by next.js before due to this problem in another scenario:
I'll put up a PR to switch the behaviour back to the way it was in 4.4.1. The |
@dymart I create snapshot build with the fix from #3059
Tried that in your repro and it resolves the issue
|
@gregmagolan thanks so much for taking a look and creating a new pr! Really appreciate it! |
@gregmagolan I don't think the problem is correctly fixed in a Windows environment and in the worst case I believe the fixes introduced at
I've found that to be a problem when trying to upgrade a project I'm working on from rules Aso to mention it is working okay on MacOS as it runs the builds in a sandbox environment and doesnt seems to be affected by those linker changes for runfiles. @gregmagolan could you have a look into this please? |
🐞 bug report
Affected Rule
There seems to have been a change to the setup or execution of run_node.
When updating to 4.4.2 the rule that uses run_node would no longer build correctly.
The rules work as expected under 4.4.1 and 4.4.0.
Is this a regression?
This seems to be a regression or a change in behaviour between minor releases. I'm not sure if the previous behaviour was taking advantage of unintentional functionality or if the change was intentional.
When updating to 4.4.2 the rule that uses run_node would no longer build correctly.
The rules work as expected under 4.4.1 and 4.4.0.
Description
The rule is running a nextjs build with run_node. With 4.4.1 everything works as expected. When changing to 4.4.2 the build breaks. I'm not very familiar with what nextjs does for it's build process in the background but a change in the nodejs rules seems to have changed it's ability to complete a build.
🔬 Minimal Reproduction
A branch to demonstrate the problem has been created: https://github.com/ubiquitoustech/rules_nextjs/tree/debug
The debug branch is the one that includes the setup to debug the problem.
In the workspace under examples/with-next-css is the example build that breaks.
from examples/with-next-css run:
$ bazel build prod
The workspace is setup to run on the broken commit initially.
https://github.com/ubiquitoustech/rules_nextjs/blob/50d111513d56111d5db3e03415f8471361def33a/examples/with-next-css/WORKSPACE#L72
Then if you switch the workspace to use the previous commit it builds.
You would need to comment out the above import and remove the comment from this one and build again.
https://github.com/ubiquitoustech/rules_nextjs/blob/50d111513d56111d5db3e03415f8471361def33a/examples/with-next-css/WORKSPACE#L55
This seems to be the commit that changes functionality: f6db6c9
The repo is large right now because there are some extra commits from rules_nodejs included in the external folder of examples/with-next-css
🔥 Exception or Error
The error is one from the nextjs build and I'm not sure what the root cause of that error would be.
This seems to be the line in nextjs that is the error. https://github.com/vercel/next.js/blob/99abb8bfd7f662efb942763332b87f4348b8844d/packages/next/build/index.ts#L136
This also seems to be the source of the problem for nextjs: https://github.com/vercel/next.js/blob/99abb8bfd7f662efb942763332b87f4348b8844d/packages/next/export/index.ts#L696
I'm not sure what changed with how nodejs dealt with symlinks but this seems to have changed the interaction with these parts of nextjs.
the problem seems to be related to nextjs not finding the build directory that is symlinked by bazel.
if the distDir in the next.config.js file is set to only '.next' the build works. If the distDir is set to the build directory that bazel links it throws an error. This build directory can be and environment variable or hard coded it doesn't make a difference it causes the same error with the nextjs build. This only occurs after the above mentioned commit to how the linker works.
I'm not exactly sure what changed in the rules_nodejs commit mentioned above that cause this change but it seems to have changed something.
I can help debug this more when I have more time. Any help resolving this would be greatly appreciated and mean that an open version of rules for nextjs would be available.
Thanks
🌍 Your Environment
ubuntu 18.04.6 LTS
bazel version 4.2.1 in .bazelversion file
rules_nodejs versions and commits are specified in repo
The text was updated successfully, but these errors were encountered: