Repository navigation
Open
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: generator-tstopic: prisma generateCLI: prisma generate
Description
Bug description
See bug. It occurs directly at startup
Severity
🚨 Critical: Data loss, app crash, security issue
Reproduction
pull the repo, install packages, generate Prisma files, then run next dev --turbo
Expected vs. Actual Behavior
fix it
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
The error has been occurring since switching to “Rust free”
Workaround
No workaround found
Prisma Schema & Queries
generator client {
provider = "prisma-client"
output = "../src/prisma"
previewFeatures = ["queryCompiler", "driverAdapters"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id String @id @default(cuid(2))
discordId String @unique
username String
logoUrl String
currentOrganizationId String?
guildIds String[] @default([])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
// Better-auth Felder
email String? @unique
emailVerified Boolean @default(false)
image String? // Könnte logoUrl verwenden
sessions Session[]
accounts Account[]
@@index([id, discordId])
}
model Session {
id String @id
expiresAt DateTime
token String
createdAt DateTime
updatedAt DateTime
ipAddress String?
userAgent String?
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([token])
@@map("session")
}
model Account {
id String @id
accountId String
providerId String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
accessToken String?
refreshToken String?
idToken String?
accessTokenExpiresAt DateTime?
refreshTokenExpiresAt DateTime?
scope String?
password String?
createdAt DateTime
updatedAt DateTime
@@map("account")
}
model Verification {
id String @id
identifier String
value String
expiresAt DateTime
createdAt DateTime?
updatedAt DateTime?
@@map("verification")
}Prisma Config
import 'dotenv/config';
import path from 'node:path';
import { defineConfig } from 'prisma/config';
export default defineConfig({
earlyAccess: true,
schema: path.join('prisma'),
});Logs & Debug Info
> next dev --turbo
▲ Next.js 15.3.1 (Turbopack)
- Local: http://localhost:3000
- Network: http://10.8.3.10:3000
- Environments: .env
✓ Starting...
✓ Ready in 1657ms
○ Compiling / ...
✓ Compiled / in 3.4s
⨯ ./src/prisma/client.ts:14:1
Module not found: Can't resolve './enums.js'
12 |
13 | import * as runtime from "@prisma/client/runtime/wasm"
> 14 | import * as $Enums from "./enums.js"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 | import * as $Class from "./internal/class.js"
16 | import * as Prisma from "./internal/prismaNamespace.js"
17 |
https://nextjs.org/docs/messages/module-not-found
./src/prisma/client.ts:18:1
Module not found: Can't resolve './enums.js'
16 | import * as Prisma from "./internal/prismaNamespace.js"
17 |
> 18 | export * as $Enums from './enums.js'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 | /**
20 | * ## Prisma Client
21 | *
https://nextjs.org/docs/messages/module-not-found
./src/prisma/client.ts:15:1
Module not found: Can't resolve './internal/class.js'
13 | import * as runtime from "@prisma/client/runtime/wasm"
14 | import * as $Enums from "./enums.js"
> 15 | import * as $Class from "./internal/class.js"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 | import * as Prisma from "./internal/prismaNamespace.js"
17 |
18 | export * as $Enums from './enums.js'
https://nextjs.org/docs/messages/module-not-found
./src/prisma/client.ts:16:1
Module not found: Can't resolve './internal/prismaNamespace.js'
14 | import * as $Enums from "./enums.js"
15 | import * as $Class from "./internal/class.js"
> 16 | import * as Prisma from "./internal/prismaNamespace.js"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 |
18 | export * as $Enums from './enums.js'
19 | /**
https://nextjs.org/docs/messages/module-not-found
○ Compiling /_error ...
✓ Compiled /_error in 1157ms
GET / 500 in 5013ms
Environment & Setup
- OS: Windows
- Database: PostgreSQL
- Node.js version: v22.14.0
Prisma Version
Loaded Prisma config from "F:\Aufträge\test\prisma.config.ts".
Prisma config detected, skipping environment variable loading.
Prisma schema loaded from prisma
prisma : 6.7.0
@prisma/client : 6.7.0
Computed binaryTarget : windows
Operating System : win32
Architecture : x64
Node.js : v22.14.0
TypeScript : 5.8.3
Query Engine (Node-API) : libquery-engine 3cff47a7f5d65c3ea74883f1d736e41d68ce91ed (at node_modules\@prisma\engines\query_engine-windows.dll.node)
Schema Engine : schema-engine-cli 3cff47a7f5d65c3ea74883f1d736e41d68ce91ed (at node_modules\@prisma\engines\schema-engine-windows.exe)
Schema Wasm : @prisma/prisma-schema-wasm 6.7.0-36.3cff47a7f5d65c3ea74883f1d736e41d68ce91ed
Default Engines Hash : 3cff47a7f5d65c3ea74883f1d736e41d68ce91ed
Studio : 0.511.0
Preview Features : driverAdapters, queryCompile
Reacted by Marcus Nerløe, Patrick Rogg, Thomas Marrec, Joevin, David DIVERRES, Ani Ravi, Mathias Colpaert, Joel Keyser, Dimitri Belozerov, Kherzie Andal and 4 more
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: generator-tstopic: prisma generateCLI: prisma generate
Activity
devpanda0 commentedon May 6, 2025
maybe any news? Can anyone reproduce the error?
djshubs commentedon May 7, 2025
I'm getting a similar error.
FGoessler commentedon May 8, 2025
Hey @devpanda0 👋
It seems you are using the new generator which is currently in preview (
provider = "prisma-client").I think we have fix for this particular issue coming up that will fix the used file extension in the generated output.
Can you try out a recent dev build like
6.8.0-dev.24please?Alternatively you can manually configure the used file extension by setting
generatedFileExtension = "tsin the generator block.You should also be able to work around this by using our old generator (
provider = "prisma-client-js") for now.devpanda0 commentedon May 8, 2025
Hey, I’ll try it out and give you some feedback. Thanks for your reply! :)
devpanda0 commentedon May 8, 2025
okay, its works now but not more in the middleware
@FGoessler
FGoessler commentedon May 14, 2025
What do you mean by "not more in the middleware" @devpanda0 ? 🤔
devpanda0 commentedon May 14, 2025
@FGoessler
⚠ ./generated/prisma/internal/class.ts:79:32
Ecmascript file had an error
77 |
78 | getQueryCompilerWasmModule: async () => {
⚠ ./generated/prisma/internal/class.ts:80:37
Ecmascript file had an error
78 | getQueryCompilerWasmModule: async () => {
79 | const { readFile } = await import('node:fs/promises')
⚠ ./generated/prisma/client.ts:13:1
Ecmascript file had an error
11 | import * as process from 'node:process'
12 | import * as path from 'node:path'
devpanda0 commentedon May 14, 2025
Tested with
6.8.0-dev.46@FGoesslerdevpanda0 commentedon May 16, 2025
Tested with
6.9.0-dev.3same problem as above. i don't know why :( @FGoesslerdevpanda0 commentedon May 16, 2025
When i use the runtime "edge-light" i got this error:
⚠ ./generated/prisma/internal
Package @prisma/client can't be external
The request @prisma/client/runtime/query_engine_bg.postgresql.wasm matches serverExternalPackages (or the default list).
Only .mjs, .cjs, .js, .json, or .node can be handled by Node.js.
12 remaining items
hanhn-dev commentedon Nov 22, 2025
I got the same issue and I solved it with my changes as following. I added
moduleFormat,generatedFileExtensionandimportFileExtension. One thing to note that I added them after migrating from v6 to v7.mosespace commentedon Nov 24, 2025
🔥 I also admit after adding the following, it was fixed. Using Nextjs 16.0.3 and Prisma Version 7
jdhenry08 commentedon Nov 24, 2025
This DID NOT work for me on [email protected].
nishatislam04 commentedon Nov 27, 2025
after implementing the guide from @hanhn-dev at latest nextjs
v16.0.5the js importing error resolved.when i first faced it, i was very lost. and had a hard time googling this issue
i hope prisma fix this issue either in built-in or add the support on the official prisma docs.
edit: i am using prisma
v7.0.1jcubic commentedon Nov 29, 2025
I just tested again. I have two databases. Adding the below code to both schema files fixed the issue. Even before upgrading to
7.0.1.prisma 报错处理.详见prisma/orm#27079
fix(prisma): 临时修复Prisma实例初始化失败问题
lexmin0412 commentedon Jan 7, 2026
Same Problem with Next.js when upgrade from v6, resolved with:
dfodeker commentedon Jan 7, 2026
I ran into the same issue while upgrading Next.js 16.0.3 and migrating Prisma from v6.6.0 → v7.2.0.
The first thing I did was delete the existing
./generated/prismafolder . ( probably not necessary )After that, I was able to fix it in a couple different ways.
Option 1: Node-style resolution (changes generated imports)
When I set Node ESM settings in
tsconfig.json:{ "compilerOptions": { "module": "nodenext", "moduleResolution": "nodenext" } }and updated the prisma generator
This caused the generated client to use .ts imports instead of .js, and the build passed. I personally could not get the generator setting to work with node as my module resolution
Option 2: Bundler-style resolution
Changing TypeScript to bundler resolution also fixed it, even though the Prisma docs recommend "moduleResolution": "node"
{ "compilerOptions": { "module": "esnext", "moduleResolution": "bundler" } }Then running bun prisma generate / npm prisma generate worked without further changes. Hopefully this helps someone else upgrading.
devnchill commentedon Jan 14, 2026
still encountering this problem . i did required changes in schema.prisma as other mentioned above , that doesn't seems to fix it. Using turborepo .
iammdsameer commentedon Jan 15, 2026
Here’s what worked for me in my Next.js app with
prisma@^7.2.0, in case anyone else runs into the same issue:Remove the entire
generated/directory (this folder is created after runningnpx prisma generate).Update
tsconfig.json{ "moduleResolution": "bundler" }Regenerate the Prisma client
After doing the above, everything started working as expected.
It seems the issue was caused by stale generated files combined with an incompatible moduleResolution setting.
problema com prisma
geneshairzan commentedon Jan 30, 2026
feat(auth): integrate Auth.js with Prisma and add middleware protection
nxtvoid commentedon Apr 22, 2026
i ran into this issue today on Turborepo
what @hanhn-dev mentioned solved this problem for me