next.js: Update to 8.0.4 breaks next build
Bug report
Describe the bug
After updating to nextjs 8.0.4 next build throws the following error:
internal/crypto/hash.js:58
throw new ERR_INVALID_ARG_TYPE('data',
^
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, TypedArray, or DataView. Received type number
at Hash.update (internal/crypto/hash.js:58:11)
Downgrading to 8.0.3 fixes that.
To Reproduce
run next build
Expected behavior
next build runs without problems.
System information
- OS: CentOS 7
- Version of Next.js: 8.0.4
Additional context
This only happens on CentOS 7 with node v10.15.1, running next build on MacOS gives no problems.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 24 (14 by maintainers)
I solved this issue deleting the old
.nextfolder and executing the build script againLooks like everyone found a resolution. Please purge your
.next/folder!I suspect that this https://github.com/zeit/next.js/blob/canary/packages/next/build/webpack/plugins/hashed-chunk-ids-plugin.ts#L27 casting into
string[]is not correct.Edit: I’ve checked and if the id that passed to
cryptois converted to a string, it solves the issue.purge the .next folder… It doesn’t work for me! We have to downgrade to 7.0.3
@Timer Funny response, cause this is just like “solve” the issue, cause If I know the root cause of the issue, I can make a reproduction repo, and I can PR a fix. Unfortunately this is not the case, I tried with a simple next app with one page, it not reproduces on my prod server.
Looks like sometime (for unknown reason) the
idis numeric, thereforecryptothrows this error.@hibearpanda same here - does not work after installing react-pdf
@Timer I’d like to request this issue to be open as well. I’ve ran into this issue as well after I installed the react-pdf package. I am using next 8.1.0.
I’ve tried deleting my build / .next folder as others have suggested, but the error still exists.
@felixmosh 's solution worked for me as well. As suspected / surmised earlier, when I log the ids in the
.forEachloop, I encounter an id that is not a string, but an integer.I will however try and upgrade to the latest canary and see if that works.
@Timer: I believe that this needs to be reopened. As previously mentioned, https://github.com/zeit/next.js/blob/canary/packages/next/build/webpack/plugins/hashed-chunk-ids-plugin.ts#L27 does not properly convert ids to string.
https://github.com/zeit/next.js/issues/6861#issuecomment-479138312 <- this fix works.