Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins

I'm on a Next.js 14 app and just switched from 6.5.0 to 6.6.0, but now I'm seeing the error Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. Upgrading prisma is the only thing that changed. the changes i made were: 1. adding the output and module formate to the prisma schema generator client { provider = "prisma-client" output = "./generated" moduleFormat = "esm" } 2. Specifying my schema in my package.json "prisma": { "schema": "./src/prisma/schema.prisma" }, 3. changing the prisma instance to use the generated client import { PrismaClient } from "@/prisma/generated/client"; 4. changing all imports in my app to use the newly generated client OLD: import type { company } from "@prisma/client"; NEW: import type { company } from "@/prisma/generated/client"; I'm assuming that I was supposed to do #4, correct? i haven't seen any documention specifically stating to do that, but I don't see why I wouldn't Any other reason I'd be seeing the error above?
3 Replies
Prisma AI Help
Skipping coffee for instant knowledge! Let's brew that AI answer now. The error you're encountering is related to the new experimental prisma-client generator in Prisma 6.6.0, which uses Node.js-specific imports like node:async_hooks that aren't compatible with Edge runtime environments. This is a known issue with Prisma 6.6.0 when using the new generator in Next.js, as documented in Prisma 6.6.0 and Edge Runtime. The problem occurs because the generated client includes imports like node:process, node:path, and node:url which aren't supported by default in webpack bundling for Edge environments. To fix this issue, you need to specify the runtime in your generator configuration:
generator client {
provider = "prisma-client"
output = "./generated"
moduleFormat = "esm"
runtime = "edge-light" // Add this for Next.js Edge compatibility
importFileExtension = "" // This helps with module resolution
}
generator client {
provider = "prisma-client"
output = "./generated"
moduleFormat = "esm"
runtime = "edge-light" // Add this for Next.js Edge compatibility
importFileExtension = "" // This helps with module resolution
}
And yes, changing your imports to use the new client location (step #4) is correct. If you continue to have issues, you have two options: 1. Revert to Prisma 6.5.0 until this is fixed 2. Use the traditional prisma-client-js generator instead of the new experimental one The new generator is experimental, so some issues are expected. If you need immediate stability, consider reverting to the previous version or using the standard generator. Let me know if you need any clarification!
EpicWerf
EpicWerfOP3d ago
now i'm seeing a new error: ⨯ PrismaClientKnownRequestError: Invalid prisma.transcript.findUniqueOrThrow() invocation: Error validating datasource db: the URL must start with the protocol prisma:// at async getTranscriptForRoleplayResults (./src/app/actions/Transcript.actions.ts:89:29) at async Page (./src/app/history/[id]/page.tsx:31:24) digest: "2227799807"
Prisma AI Help
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.

Did you find this page helpful?