unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

read ETIMEDOUT at TCP.onStreamRead (node:internal/stream_base_commons:217:20) #2503

Closed hoanghiep1x0 closed 3 months ago

hoanghiep1x0 commented 3 months ago

Environment

Reproduction

https://stackblitz.com/~/github.com/hoanghiep1x0/nitro-clone

Describe the bug

My project is currently running normally, but every 5 or 15 minutes without any interaction from the client, I encounter the error read ETIMEDOUT at TCP.onStreamRead (node:internal/stream_base_commons:217:20). This is exactly like the issue described in this GitHub issue. How can I fix it?

Additional context

I'm running a project with Nuxt and trying to replicate the issue regarding write pipe and read ETIMEDOUT, seemingly originating from Nitro. project nuxt : https://stackblitz.com/~/github.com/hoanghiep1x0/nuxt3-project project nitro : https://stackblitz.com/~/github.com/hoanghiep1x0/nitro-clone My project is functioning normally, but every 5 or 15 minutes without any client interaction, I encounter the read ETIMEDOUT error when sending requests using $fetch or useFetch in Nuxt. How can I address this issue?

Logs

admin@Admins-MacBook-Pro news % npm run dev 

> dev
> nuxt dev --inspect

[2:27:17 PM] Nuxt 3.11.2 with Nitro 2.9.6
[2:27:20 PM] 
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

Debugger listening on ws://127.0.0.1:9229/dda2310c-2c73-41af-9606-35bdce5ef712
For help, see: https://nodejs.org/en/docs/inspector
[nuxt:tailwindcss 2:27:26 PM] ℹ Using default Tailwind CSS file
[2:27:31 PM]   ➜ DevTools: press Shift + Option + D in the browser (v1.3.2)

[nuxt:tailwindcss 2:27:33 PM] ℹ Tailwind Viewer: http://localhost:3000/_tailwind/
[2:27:34 PM] ℹ Compiled types/plugins.d.ts in 609.09ms
[2:27:34 PM] ℹ Compiled plugins/server.mjs in 606.53ms
[2:27:34 PM] ℹ Compiled plugins/client.mjs in 614.99ms
[2:27:57 PM] ℹ Vite client warmed up in 20802ms
[2:28:02 PM] ℹ Vite server warmed up in 24629ms
[nitro 2:28:03 PM] ✔ Nuxt Nitro server built in 9762 ms
connect mongoodb
All models initialized successfully
read ETIMEDOUT

  at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
  at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
read ETIMEDOUT

  at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
  at TCP.callbackTrampoline (node:internal/async_hooks:130:17)