prisma: `prisma-client`: TypeError: __banner_node_url when using enums on the client-side

Bug description

I upgraded to prisma 6.6.0 and getting this error randomly this morning in my browser. This is specific to 6.6.0 and going back to 6.5.0 is fine again.

I’m using Bun with a turbo monorepo with Tanstack Start

generator client {
    provider     = "prisma-client" // no `-js` at the end
    output       = "./generated/prisma" // `output` is required
    moduleFormat = "esm" // or `"cjs"` for CommonJS
}

browser error:

@prisma_client_runtime_library.js?v=16686fa7:135 Uncaught (in promise) TypeError: __banner_node_url.

Severity

⚠️ Major: Breaks core functionality (e.g., migrations fail)

Reproduction

upgraded from 6.5.0 and applied the new generator

Expected vs. Actual Behavior

expected to see new 6.6.0 behavior

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

“Yes, last worked in Prisma 6.5.0, broke in 6.6.0”

Workaround

“Downgrading to Prisma 6.5.0 fixes it”

Prisma Schema & Queries

generator client {
    provider     = "prisma-client" // no `-js` at the end
    output       = "./generated/prisma" // `output` is required
    moduleFormat = "esm" // or `"cjs"` for CommonJS
}

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 14
  • Comments: 20 (6 by maintainers)

Most upvoted comments

Are you folks trying to import the types into frontend code which has no knowledge of node specific things like file access? 🤔

If you are barely interested in the types of certain objects and enums you can starting with Prisma 6.7.0 and the new generator import directly from a specific model file. E.g. import { type UserModel } from '~/generated/prisma/models/User';.

Does this help?

well I’m doubly confused now… I got rid of all my enum imports (client and server side) and updated to 6.7 with esm and still getting the same error

Uncaught (in promise) TypeError: __banner_node_url.fileURLToPath is not a function
    at @prisma_client_runtime_library.js?v=47d97b54:128:36

Same here, I made the mistake of adding an enum, then removed all traces and I am back with this error. I see the generated enum.ts file but there is not really anything to import because the enum is not used.

well I’m doubly confused now… I got rid of all my enum imports (client and server side) and updated to 6.7 with esm and still getting the same error

Uncaught (in promise) TypeError: __banner_node_url.fileURLToPath is not a function
    at @prisma_client_runtime_library.js?v=47d97b54:128:36

Also have this issue using monorepo, yarn with React Router version 7, framework mode. Especially when trying to import an enum into client side code.

I am seeing a similar error after updating to 6.6.0.

Browsers error:

Uncaught TypeError: __banner_node_url.fileURLToPath is not a function at @prisma_client_runtime_library.js?v=84dfa45b:151:36
generator client {
  provider        = "prisma-client"
  output          = "./generated/prisma"
  previewFeatures = ["prismaSchemaFolder"]
  moduleFormat    = "esm"
}

My issue here was that I was including prima code in my client bundle. I specifically had some constants exported from a file that was handling my database interactions. I moved the constants into a different file that I then import from and then these errors went away. vite complained about node:url being included in the client bundle which sent me down the path to find this. I’m using react-router v7 with vite.

I’m having the same problem with latest Nuxt when I try to import from the generated client 6.6.0

import { UserRole } from 'prisma/client' or import { UserRole } from '@/prisma/client'

with this config

generator client {
  provider        = "prisma-client"
  moduleFormat    = "esm"
  output          = "./client"
  previewFeatures = ["fullTextSearchPostgres"]
}

historically I’ve had a lot of bizarre issues with Prisma when using the enums in the frontend for types… I’m assuming UserRole is an enum in your example? I have lots of enums in my Prisma project that I use in my frontend code.

As you all seem to use the new prisma-client generator that is in early access: In the upcoming 6.7.0 we introduce a file splitting for the new generator that will make all user defined enums available in a dedicated file. You can then import this single file enums.ts file from the generated output.

The currently generated output in 6.6.0 in the new generator is not suitable to be used in browser environments as is.