Nikita Revenco
Nikita Revenco
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Prisma Client is not configured to run in the edge runtime
if I do, ill let you know
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
yes!, I am also using bcryptjs
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
Looks like for now your solution is likely the best workaround at the moment. Would be nice to actually be able to use middleware.ts once this gets fixed though
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 also found an issue which is directly related to this: https://github.com/brianc/node-postgres/issues/3206
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
No description
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
Since I am using the prisma resolver
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 have a question, if I can't access the prisma client, and by extension auth, how am I supposed to know if the user is authenticated or not? This is how I used to do it:
const session = await auth();
const session = await auth();
But since I can't use the auth function I have no idea how to get the user's session without using prisma client
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
thanks mate
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 need better time management skills
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
bruh I spend 5 hours on this LOL
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
omg you're right
18 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
What actually happens is TS thinks that db has db.model which shouldn't happen
12 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
No description
12 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
Ideally we can somehow set var prisma: PrismaClientWithExtension<typeof extension> or something like that. Not sure if it's a thing though
12 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
Your code has the same problem as mine though, since you are setting prisma: PrismaClient if you want your prisma client to have an extension it will be of the wrong type. eg:
import { PrismaClient } from '@prisma/client';

const extension = { /* ... */ }

declare global {
var prisma: PrismaClient | undefined;
}

const prisma = globalThis.prisma || new PrismaClient().$extends(extension);

if (process.env.NODE_ENV !== 'production') globalThis.prisma = prisma;

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

const extension = { /* ... */ }

declare global {
var prisma: PrismaClient | undefined;
}

const prisma = globalThis.prisma || new PrismaClient().$extends(extension);

if (process.env.NODE_ENV !== 'production') globalThis.prisma = prisma;

export default prisma;
You see, we have added an extension to PrismaClient but the type of prisma is still PrismaClient, so like if our extension has a method then typescript won't know about it
12 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
This isn't on the middleware, it's in prisma/index.ts. This error doesn't happen if I remove the createPrismaClient function. e.g.: No Error:
const globalForPrisma = globalThis as unknown as {
db: PrismaClient;
};

const db = globalForPrisma.db || new PrismaClient();
const globalForPrisma = globalThis as unknown as {
db: PrismaClient;
};

const db = globalForPrisma.db || new PrismaClient();
Yes Error:
const createPrismaClient = () => {
return new PrismaClient().$extends(extension);
};

const globalForPrisma = globalThis as unknown as {
db: ReturnType<typeof createPrismaClient>;
};

const db = globalForPrisma.db || createPrismaClient()
const createPrismaClient = () => {
return new PrismaClient().$extends(extension);
};

const globalForPrisma = globalThis as unknown as {
db: ReturnType<typeof createPrismaClient>;
};

const db = globalForPrisma.db || createPrismaClient()
12 replies
PPrisma
Created by Nikita Revenco on 7/12/2024 in #help-and-questions
Get type of prisma client before it is defined
No description
12 replies