next.js: Build failing with `spawn ENOMEM` / `spawn E2BIG`
Bug report
Describe the bug
In some circumstances, next build is failing in CI environment (CircleCI) with the exception `Callback was already called’.
There is a random factor and it’s not happening 100% of the time, but more than 50% at the moment.
This is triggered from the neo-async package which is used by webpack:
/home/circleci/project/node_modules/neo-async/async.js:14
throw new Error('Callback was already called.');
^
Error: Callback was already called.
at throwError (/home/circleci/project/node_modules/neo-async/async.js:14:11)
at /home/circleci/project/node_modules/neo-async/async.js:2805:7
at afterBuild (/home/circleci/project/node_modules/webpack/lib/Compilation.js:859:17)
at processTicksAndRejections (internal/process/next_tick.js:74:9)
Example
See for example: https://circleci.com/gh/opencollective/opencollective-frontend/5926
Version
This is a new issue after upgrading to next 8.0.x, we never had it with next 7.0.x.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 2
- Comments: 21 (14 by maintainers)
@znarf It looks like in CircleCI the
os.cpus()returns all the CPUs and not the limited amount for the current run. This explains why it was working in local CircleCI but not in their environment. This has been updated and we also added passingwebpackto theoptionsparameter of thewebpackfunction in next.config.js.The draft PR I opened should allow you to update to v8 after we release a new canary with this fix. There is one e2e test failing on that PR and I’m not sure if that is due to Next 8 or not. If it is I can look into it further.