question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Next.js 8.1 has broken build: The "original" argument must be of type function

See original GitHub issue

Bug report

Describe the bug

Since upgrading my version of next from 8.0.4 to 8.1, the next build command no longer works and the following is outputted:

“(node:1055) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError [ERR_INVALID_ARG_TYPE]: The “original” argument must be of type function (node:1055) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.”

Can confirm that this is a new bug, as downgrading next version back to 8.0.4 resolves the issue. The issue is not only present in my apps, but also the examples.

To Reproduce

  1. Clone the next.js repo.
  2. Change directory to /examples/custom-server.
  3. npm i.
  4. next run build.

And you’ll end up with the above error.

Expected behavior

A production-optimised build of the app is generated.

System information

  • OS: macOS
  • Version of Next.js: 8.1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

7reactions
stovmascriptcommented, Apr 24, 2019

I have the ~same~ problem. What is your node version @LoicVerrall? I’m running v11.10.0.

Edit: Actually my error is different, but the outcome is the same:

$ yarn build
yarn run v1.15.2
$ rimraf .next && next build
Creating an optimized production build ...

[00:08:47] Compiling client
[00:08:47] Compiling server
> Using external babel configuration
> Location: "/.../.babelrc"
(node:46139) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, Buffer, TypedArray, or DataView. Received type number
    at Hash.update (internal/crypto/hash.js:64:11)
    at ids.forEach.id (/.../node_modules/next/dist/build/webpack/plugins/hashed-chunk-ids-plugin.js:24:41)
    at Array.forEach (<anonymous>)
    at compilation.hooks.beforeChunkIds.tap.chunks (/.../node_modules/next/dist/build/webpack/plugins/hashed-chunk-ids-plugin.js:24:25)
    at SyncHook.eval [as call] (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:12:1)
    at SyncHook.lazyCompileHook (/.../node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeTree.callAsync.err (/.../node_modules/webpack/lib/Compilation.js:1275:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/.../node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:9:1)
    at AsyncSeriesHook.lazyCompileHook (/.../node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.seal (/.../node_modules/webpack/lib/Compilation.js:1244:27)
(node:46139) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:46139) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[00:09:06] Compiled server in 19s
✨  Done in 21.83s.
1reaction
Timercommented, Apr 24, 2019

Excellent @stovmascript, can you send a PR removing that switch from the plugin? 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js 8.1 has broken build: The "original" argument must be ...
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >
webpack next.js TypeError: The "original" argument must be of ...
When I run npm run dev, I get the following error: If there is someone who understands, please teach me. // error contents....
Read more >
typeerror [err_invalid_arg_type]: the "data" argument must be ...
So the error is saying the data (second argument of the fs.writeFileSync function) should be a string or a buffer...etc but instead got...
Read more >
Google JavaScript Style Guide
This Style Guide uses RFC 2119 terminology when using the phrases must, ... Exception: Types, variables, and functions declared in externs files have...
Read more >
History - Math.js
Conversions now have preference over any . The this variable is no longer bound to the typed function itself. The properties typed.types ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found