P
Prisma2mo ago
pedro

Getting Reading from "node:async_hooks" is not handled by plugins onnextJs server actions

Here is my config: - custom generated path inside my packages/db monorepo package - the prisma package is "type": "module" - The error only happens on nextJs server actions (I believe because of different runti then server components) Can anyone help me? Two days trying to figure this out already.
8 Replies
Prisma AI Help
Prisma AI Help2mo ago
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into #ask-ai if you get antsy for a second opinion!
pedro
pedroOP2mo ago
No, please answer great ai bot
Nurul
Nurul2mo ago
Can you share the full error message you are getting? Is your repository open source? A minimal reproduction would help in figuring out what's causing this issue.
pedro
pedroOP2mo ago
It's not open source, it's a project that we planned to launch by the end of July. Gonna try to create a minimal reproduction
Nurul
Nurul2mo ago
That would be very helpful. Thanks!
pedro
pedroOP2mo ago
I have no idea how to reproduce it. I tried to multiple times but I can't reproduce from a clean repository. I tried backtracking a couple commits on our main repository (when it was working) and do the changes one by one. Turns out the issue started happening when I moved my custom output to inside of my db package, instead of the root of my monorepo. Now, if I import anything from prisma (types or enums in example) into a nextJs server action, I get an error saying I'm trying to use node apis inside of the edge/javascript runtime. In example node:async_hooks or more recently, the fs (when I moved from provider = "prisma-client-js" to provider = "prisma-client")
Nurul
Nurul2mo ago
Turns out the issue started happening when I moved my custom output to inside of my db package, instead of the root of my monorepo.
Just to confirm, if you change the custom output path again to the root of monorepo, it again starts to work?
pedro
pedroOP2mo ago
yes, it starts working again. But I'm making progress, I think it might not be prisma at fault, but a wrong tsconfig. I will get back here because even if it's my fault, I think it might be good to get it documented. If I remove my typedSql code it works again. I reproduced it with two preview features, the new prisma generators and typedsql. Here's the minimal reproductionusing the new prisma generator: https://github.com/prisma/prisma/issues/27766 Turns out we had both tsconfig and prisma issues

Did you find this page helpful?