Fix Docker Prisma constructor error

- Remove --ignore-scripts from npm ci in builder stage
- Simplify Prisma client initialization
- Ensure proper file copying order in Docker
- Remove async connection handling that may cause issues
This commit is contained in:
2025-12-02 13:49:51 +00:00
parent c0358d79d7
commit 3a3db4195f
2 changed files with 7 additions and 18 deletions

View File

@@ -4,22 +4,8 @@ const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
// Create Prisma client with connection error handling
export const prisma = globalForPrisma.prisma ?? new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'],
})
// Handle connection errors
prisma.$connect().catch((error) => {
console.error('Failed to connect to database:', error)
// Don't throw here - let individual queries handle connection errors
})
// Graceful shutdown
if (typeof window === 'undefined') {
process.on('beforeExit', async () => {
await prisma.$disconnect()
})
}
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma