ketzo
ketzo
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
Bcrypt imports the crypto package from node, which isn’t supported in edge runtime I wasn’t running it in middleware but was still getting that error; I never tracked down exactly where it was getting called in Edge, I just ripped it out completely Let me know if you figure out a good way to hash/store passwords, I still need to do that!
18 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
Hahaha I swear you’re walking the exact same path as me I bet you are using the “bcrypt” package to do Credentials authentication, right? I also couldn’t get that to work; right now I’m just using Google for signin, was gonna come back to email/password later
18 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
I’m still using Prisma with next-auth, I just literally have no middleware.ts file at all right now
18 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
I spent 3-4 hours on it myself and also came to ask a question here, hahaha so honestly, I don’t know how you’re supposed to do it in middleware. but you can do that await auth() call in any server component, and authenticate users that way that’s what I’m doing; all my authentication/authorization is done within my React components
18 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
I had this same error (within NextJS) because I was trying to use the Prisma client within middleware, which does use the edge runtime. Maybe check that?
18 replies
PPrisma
Created by Mkiza on 6/13/2024 in #help-and-questions
Error: @prisma/client did not initialize yet.
I had a similar issue, and I think I solved it by setting up a separate Prisma client file that looks like this
import { PrismaClient } from "@prisma/client";

let prisma: PrismaClient;

declare global {
var prisma: PrismaClient | undefined;
}

if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient();
} else {
if (!global.prisma) {
global.prisma = new PrismaClient();
}
prisma = global.prisma;
}

export default prisma;
import { PrismaClient } from "@prisma/client";

let prisma: PrismaClient;

declare global {
var prisma: PrismaClient | undefined;
}

if (process.env.NODE_ENV === "production") {
prisma = new PrismaClient();
} else {
if (!global.prisma) {
global.prisma = new PrismaClient();
}
prisma = global.prisma;
}

export default prisma;
Then I just import prisma from @/lib/prisma.ts wherever I want to use the client.
9 replies