next.js: [turbopack + prisma] TypeError: The "path" argument must be of type string. Received undefined
Link to the code that reproduces this issue
https://github.com/DiPSoMaNiE/next-canary-prisma-issue
To Reproduce
- Clone https://github.com/DiPSoMaNiE/next-canary-prisma-issue
- Run
bun install - Run
prisma generate - Run
bun dev - Go to
http://localhost:3000and see error
Current vs. Expected behavior
This error occurs when:
- using
next@15.2.0-canary.40or above (works on15.2.0-canary.39and below) - using
next dev --turbopack(works withnext devornext buildwhich use webpack) - using custom output path in the
generatorblock ofschema.prisma
To make it work:
- Comment the
output = "../generated"line inprisma/schema.prisma - Run
prisma generate - Change
import { PrismaClient } from '../generated'toimport { PrismaClient } from '@prisma/client'insrc/db.ts - Run
bun dev - Go to
http://localhost:3000and see it works
Everything should work as expected with a custom output path for the generated PrismaClient.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 12
Binaries:
Node: 22.14.0
npm: 10.9.2
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 15.2.0-canary.74 // Latest available version is detected (15.2.0-canary.74).
eslint-config-next: 15.2.0-canary.74
react: 19.0.0
react-dom: 19.0.0
typescript: 5.7.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
prisma : 6.4.1
@prisma/client : 6.4.1
Computed binaryTarget : darwin-arm64
Operating System : darwin
Architecture : arm64
Node.js : v22.14.0
TypeScript : 5.7.3
Query Engine (Node-API) : libquery-engine a9055b89e58b4b5bfb59600785423b1db3d0e75d (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node)
Schema Engine : schema-engine-cli a9055b89e58b4b5bfb59600785423b1db3d0e75d (at node_modules/@prisma/engines/schema-engine-darwin-arm64)
Schema Wasm : @prisma/prisma-schema-wasm 6.4.0-29.a9055b89e58b4b5bfb59600785423b1db3d0e75d
Default Engines Hash : a9055b89e58b4b5bfb59600785423b1db3d0e75d
Studio : 0.509.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 27
- Comments: 25 (10 by maintainers)
Commits related to this issue
- Bump deps, downgrade Next.js https://github.com/vercel/next.js/issues/76497 — committed to vercel/next-forge by haydenbleasel 2 years ago
- Internationalization and Languine (#473) * Scaffold internationalization package * Bump deps, downgrade Next.js https://github.com/vercel/next.js/issues/76497 * Update pnpm-lock.yaml * Scaffold p... — committed to vercel/next-forge by haydenbleasel 2 years ago
- Turbopack: fix `__dirname` (#76902) `__dirname` was always `undefined` due to a typo. This was a regression from https://github.com/vercel/next.js/pull/75358, the PR restores the behavior of 15.1.7 ... — committed to vercel/next.js by mischnic 2 years ago
- Internationalization and Languine (#473) * Scaffold internationalization package * Bump deps, downgrade Next.js https://github.com/vercel/next.js/issues/76497 * Update pnpm-lock.yaml * Scaffold p... — committed to smartai9605/forge-next by smartai9605 2 years ago
Confirmed fixed for me in 15.2.2-canary-4 release
This was also just released in v15.2.2
same issue with latest next 15.2.1
Iām also encountering this error when trying to import
@google-cloud/pubsub:The issue seems to be that
__dirnameisundefinedwhen using Turbopack. I tested this in a Server Component with the following code:With Webpack, the directory containing the file is correctly printed. However, when using Turbopack,
__dirnameisundefined.removing the turbo flag works. makes you appreciate how quick the thing is š¦
Confirmed this also happens in the stable 15.2.0 next release
Same error with google-ads-api library https://www.npmjs.com/package/google-ads-api
NextJS 15 with turbopack. Without the turbopack flag it works.
seeing same thing after 15.2 upgrade with
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';, seeing this error:TypeError: The "path" argument must be of type string. Received undefinedEDIT: running
next devworks, andnext dev --turbodoes notI also got the same error after trying to upgrade to Nextjs 15.2. Using turborepo and prisma as a package
Can confirm this is an issue
Edit by maintainer bot: Comment was automatically minimized because it was considered unhelpful. (If you think this was by mistake, let us know). Please only comment if it adds context to the issue. If you want to express that you have the same problem, use the upvote š on the issue description or subscribe to the issue for updates. Thanks!