Skip to content
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

TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('SIGINT') #173

Open
4 tasks done
bennycode opened this issue Jul 16, 2024 · 0 comments

Comments

@bennycode
Copy link

Checklist

  • I have looked into the Readme and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

When hitting Ctrl + C while the application is running, it won't stop and crash instead with the following error:

(/home/bennycode/dev/bennycode/benny-carbon-hub/node_modules/next/dist/server/lib/start-server.js:208:29)
[0]     at process.emit (node:events:526:35) {
[0]   code: 'ERR_INVALID_ARG_TYPE'
[0] }
[0]  X uncaughtException: TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('SIGINT')

Reproduction

  1. npm run dev
  2. Hit "Ctrl + C" on Windows to stop the processs

Additional context

The problem exists because the samples use the outdated Next.js v13 which has a bug in it's cleanup code:

                const cleanup = (code)=>{
                    debug("start-server process cleanup");
                    server.close();
                    process.exit(code ?? 0);
                };
                process.on("SIGINT", cleanup);

The start-server.js file in Next v13 sends the string SIGINT to process.exit which is not allowed as it is not a number.

It is fixed in Next v14.0.1 -> https://github.com/vercel/next.js/blob/v14.0.1/packages/next/src/server/lib/start-server.ts#L273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant