blitz
blitz copied to clipboard
Prisma Accelerate
What do you want and why?
I want to migrate my blitz app from previous Prisma Data Proxy to the new Accelerate product but extending prisma + enhancePrisma + blitz-server AuthServerPlugin PrismaStorage types don't play well together
Possible implementation(s)
import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'
import { enhancePrisma } from 'blitz'
const EnhancedPrisma = enhancePrisma(PrismaClient)
export default new EnhancedPrisma().$extends(withAccelerate())
This breaks all db collection types in tsc and using it without enhancePrisma just breaks the types in PrismaStorage(db)
export const { gSSP, gSP, api } = setupBlitzServer({
plugins: [
AuthServerPlugin({
...authConfig,
storage: PrismaStorage(db),
...
}),
],
...
})
Additional context
Latest blitz version
Any progress on this?
We'll take a PR for this, otherwise you can just use Prisma without the enhancePrisma() wrapper.
otherwise you can just use Prisma without the enhancePrisma() wrapper.
Not really the case, Prisma errors to
when using
PrismaClient
although its only used on the server.
Error is solved when you remove .$extends(...)