Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma Accelerate #4251

Open
madhenry opened this issue Nov 10, 2023 · 3 comments
Open

Prisma Accelerate #4251

madhenry opened this issue Nov 10, 2023 · 3 comments
Labels
status/ready-to-work-on This issue is up for grabs

Comments

@madhenry
Copy link

madhenry commented Nov 10, 2023

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

CleanShot 2023-11-10 at 14 23 17@2x

@cfragkos
Copy link

Any progress on this?

@flybayer
Copy link
Member

We'll take a PR for this, otherwise you can just use Prisma without the enhancePrisma() wrapper.

@papsavas
Copy link
Contributor

papsavas commented Jan 25, 2024

otherwise you can just use Prisma without the enhancePrisma() wrapper.

Not really the case, Prisma errors to
image
when using PrismaClient although its only used on the server.

Error is solved when you remove .$extends(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/ready-to-work-on This issue is up for grabs
Projects
None yet
Development

No branches or pull requests

6 participants