nuxt: Dev server frequently freezes when using NX and Prisma
Environment
- Operating System:
Windows_NT - Node Version:
v16.14.0 - Nuxt Version:
3.0.0-rc.1 - Package Manager:
npm@8.3.1 - Builder:
vite - User Config:
typescript - Runtime Modules:
- - Build Modules:
-
Reproduction
https://github.com/rdmchr/Rose/tree/vite
- Clone the repo
- Switch to the
vitebranch - Run
npm i - Create a .env file with the following content:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
- Run
npm run dev - Open the index page in your browser
- Wait ~2 minutes
- Reload the tab
Describe the bug
After some time the Vite dev server no longer responds to requests. Requests sent to the server neither load nor time out. This affects both frontend and server URLs.
There are no errors in the vite console nor in the browser console.
Additional context
No response
Logs
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 20 (6 by maintainers)
I have similar issue with Nuxt 3.0.0-rc.3. Here my reproduction repo.
I Call Prisma in single server api: https://github.com/cawa-93/nuxt-prisma-hmr-issue/blob/e42d72ca6fd6226601971f6001a9342764e9f45a/server/api/users.ts
FIrst time request to
/api/usersreturn[]as expected. But after HMR server gets stuck or crashesAlso I had to change the implementation slightly this is what my new implementation looks like.
So switching to WSL could at least be a temporary workaround?
It must come from Windows. I don’t have this problem on Linux
Exactly the same problem, either I could not get an answer from Nitro. Or it’s prisma trying to connect to the pool and never succeeding. However when I restart Nuxt, no problem, until the hot reload. (And it depends on the time…)
I have the impression that it is related to Prisma, because if I have no connection to a db, it always works well.