File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,17 @@ const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
1313// @todo : we can mark this as `__unsafePrisma` in the future once we've migrated
1414// all of the actions & queries to use the userScopedPrismaClientExtension to avoid
1515// accidental misuse.
16- export const prisma = globalForPrisma . prisma || new PrismaClient ( )
16+ export const prisma = globalForPrisma . prisma || new PrismaClient ( {
17+ // @note : even though DATABASE_URL is of type string, we need to check if it's defined
18+ // because this code will be executed at build time, and env.DATABASE_URL will be undefined.
19+ ...( env . DATABASE_URL ? {
20+ datasources : {
21+ db : {
22+ url : env . DATABASE_URL ,
23+ } ,
24+ }
25+ } : { } )
26+ } )
1727if ( env . NODE_ENV !== "production" ) globalForPrisma . prisma = prisma
1828
1929/**
You can’t perform that action at this time.
0 commit comments