P
Prisma•2w ago
sync

TypeError: Cannot read properties of undefined (reading '__internal')

I upgraded to Prisma 7, and when I try to start my project, it starts giving an error in @prisma/client and I don't know why, everything is configured correctly.
No description
No description
No description
36 Replies
Prisma AI Help
Prisma AI Help•2w ago
You've gone full bot mode! Let me fetch that AI answer for you ASAP. The error TypeError: Cannot read properties of undefined (reading 'internal') after upgrading to Prisma 7 is a known issue, especially in monorepo setups or when using custom configurations. Based on the knowledge sources, here are the most likely causes and solutions: 1. Prisma 7 Requires an Adapter: With Prisma 7, the default client is now "Rust-free" and requires you to initialize your PrismaClient with an adapter (or accelerateUrl). If you see an error mentioning "engine type 'client' requires either 'adapter' or 'accelerateUrl'", you need to update your PrismaClient initialization. See the Prisma 7 breaking changes for more details. 2. Out-of-Sync Client and Runtime: If you manually install or update packages like @prisma/client-runtime-utils, you may end up with mismatched versions between the generated client and the runtime, leading to the internal error. Always ensure you run npx prisma generate after upgrading and that all Prisma-related packages are on the same version. This issue is especially common in pnpm monorepos due to symlink and hoisting behavior. Reverting to Prisma 6 resolved the issue for some users, but ideally, ensure all dependencies are aligned and generated code is up-to-date source. 3. Seeding and Custom Config: Some users encountered this error when running seed scripts after upgrading. Placing prisma.config.ts at the project root and ensuring it is correctly configured resolved the issue for them source. Summary of steps to try: - Ensure you have a prisma.config.ts at your project root if required. - Update your PrismaClient initialization to include an adapter if using the Rust-free client. - Run npx prisma generate after any upgrade. - Make sure all Prisma packages are on the same version. - If using a monorepo, check for issues with symlinks and hoisting. If these steps do not resolve your issue, the knowledge sources do not provide a more specific solution. šŸ¤” 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.
Kiryo
Kiryo•2w ago
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
use the new prisma-client instead of js also create singleton for prisma client
sync
syncOP•2w ago
I'm getting this error now, I'm using it the way you said.
No description
No description
No description
Kiryo
Kiryo•2w ago
it says you need to generate prisma generate
sync
syncOP•2w ago
It has already been generated in ./generated/prisma
Kiryo
Kiryo•2w ago
when you change the client you need to generate new one
sync
syncOP•2w ago
Yes, I know, and I generated it; it's there in the terminal.
sync
syncOP•2w ago
No description
Kiryo
Kiryo•2w ago
import { PrismaClient } from "@prisma/client";

const g = globalThis as unknown as { prisma?: PrismaClient };
export const prisma = g.prisma ?? new PrismaClient({ log: ["warn", "error"] });
if (process.env.NODE_ENV !== "production") g.prisma = prisma;
import { PrismaClient } from "@prisma/client";

const g = globalThis as unknown as { prisma?: PrismaClient };
export const prisma = g.prisma ?? new PrismaClient({ log: ["warn", "error"] });
if (process.env.NODE_ENV !== "production") g.prisma = prisma;
try this
sync
syncOP•2w ago
It gave the same error, I don't know why.
No description
sync
syncOP•2w ago
No description
Kiryo
Kiryo•2w ago
maybe cache try to delete the whole genereated folder restart your ide and generate once more
sync
syncOP•2w ago
Ok
sync
syncOP•2w ago
I'm still having the same problem, in @prisma/client, I don't know why, I did everything you said.
No description
Kiryo
Kiryo•2w ago
hmm downgrade to prisma 6.19 prisma 7 seems not ready now
Kiryo
Kiryo•2w ago
No description
Kiryo
Kiryo•2w ago
literaly i've made one with those configs and it worked like 20 mins ago so it could be everything
sync
syncOP•2w ago
ok, It worked for me, thank you!
Kiryo
Kiryo•2w ago
we need to wait for prisma 7.1 something with the 7.0 configs is just not working right
sync
syncOP•2w ago
Okay, I had updated it because the Prisma extension kept telling me to update, etc...
Kiryo
Kiryo•2w ago
same literaly spent like 2 hours figuring this out today XD
sync
syncOP•2w ago
lol I'll keep an eye on it now when it updates to see if it's a stable version so I don't suffer again.
niko
niko•2w ago
@Kiryo @sync pass an empty object into PrismaClient to fix the error! this one
sync
syncOP•2w ago
Like this?
niko
niko•2w ago
like what?
sync
syncOP•2w ago
How do I do that?
niko
niko•2w ago
const client = new PrismaClient({});
const client = new PrismaClient({});
{} is the empty object which you need to pass into the PrismaClient constructor
sync
syncOP•2w ago
oh okay Sorry, I don't know English very well and sometimes the translator doesn't help.
niko
niko•2w ago
oh okay
sync
syncOP•2w ago
That's what happened, but which adapter can I use for PostgreSQL?
No description
sync
syncOP•2w ago
No description
Parwar Yassin
Parwar Yassin•2w ago
hi i had same issue along side other in turborepo setup i fixed this setup,
Parwar Yassin
Parwar Yassin•2w ago
and in the package.json file you should add this "type": "module", before the script
No description
No description
Parwar Yassin
Parwar Yassin•2w ago
and also you should download this "@prisma/client-runtime-utils": "^7.0.0",
niko
niko•2w ago
the postgresql adapter sir it's in the docs
Aman
Aman•7d ago
You are outputting the prisma client in ../generated/prisma So you need to import from the generated folder not @prisma/client import { PrismaClient } from "../generated/prisma/client" Docs - https://www.prisma.io/docs/getting-started/prisma-orm/quickstart/postgresql
Quickstart: Prisma ORM with PostgreSQL (10 min) | Prisma Documentation
Create a new TypeScript project from scratch by connecting Prisma ORM to PostgreSQL and generating a Prisma Client for database access.

Did you find this page helpful?