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

Invalid ERR_INVALID_ARG_TYPE on SIGINT #55605

Closed
1 task done
Yovach opened this issue Sep 19, 2023 · 7 comments · Fixed by #55606
Closed
1 task done

Invalid ERR_INVALID_ARG_TYPE on SIGINT #55605

Yovach opened this issue Sep 19, 2023 · 7 comments · Fixed by #55606
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked

Comments

@Yovach
Copy link
Contributor

Yovach commented Sep 19, 2023

Link to the code that reproduces this issue

https://github.com/Yovach/nextjs-sigint

To Reproduce

  1. Install Node.js 20 (I din't tried 18)
  2. Start the application with pnpm dev
  3. Press CMD/CTRL + C

Current vs. Expected behavior

Current :
X uncaughtException: TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('SIGINT')
at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
at process.exit (node:internal/process/per_thread:188:24)
at process.cleanup (/home/quentin/labs/reproduction-app/node_modules/.pnpm/next@13.5.1-canary.1_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/server/lib/start-server.js:208:29)
at process.emit (node:events:526:35) {
code: 'ERR_INVALID_ARG_TYPE'
}

Following the previous step, the next dev server should gracefully stop without error like in 13.4.19

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Mon Aug 7 19:01:48 UTC 2023
    Binaries:
      Node: 20.7.0
      npm: 10.1.0
      Yarn: 1.22.19
      pnpm: 8.7.6
    Relevant Packages:
      next: 13.5.1-canary.1
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3
    Next.js Config:
      output: N/A


warn  - Latest canary version not detected, detected: "13.5.1-canary.1", newest: "13.5.1".
        Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
        Read more - https://nextjs.org/docs/messages/opening-an-issue

Which area(s) are affected? (Select all that apply)

CLI (create-next-app)

Additional context

No response

@Yovach Yovach added the bug Issue was opened via the bug report template. label Sep 19, 2023
@github-actions github-actions bot added the create-next-app Related to our CLI tool for quickly starting a new Next.js application. label Sep 19, 2023
@vanpham1986

This comment was marked as spam.

@ovflowd
Copy link

ovflowd commented Sep 19, 2023

Can confirm and reproduce

@kodiakhq kodiakhq bot closed this as completed in #55606 Sep 19, 2023
kodiakhq bot pushed a commit that referenced this issue Sep 19, 2023
## Fixing a bug

### What?

On these versions, SIGINT signals are `string`, exit callback recieves code `number`

### How?

We use code argument to quit process for `event`, and exit with code `0` for `SIGINT` and `SIGTERM` signals 

Fixes #55605


Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com>
@DaKheera47
Copy link

Same issue here! for me this happens when i ctrl + c to close the dev server

@peter-kuhmann
Copy link

❌ I get the same error with Node.js v20.3.1.

✅ But with Node.js v18.18.0 the problem does not occur.

@Yovach
Copy link
Contributor Author

Yovach commented Sep 20, 2023

❌ I get the same error with Node.js v20.3.1.

✅ But with Node.js v18.18.0 the problem does not occur.

Have you tried the latest version ? https://github.com/vercel/next.js/releases/tag/v13.5.2

@peter-kuhmann
Copy link

Ah yes, 13.5.2 fixes it! Thanks @Yovach 🙂

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Oct 5, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants