PrismaP
Prisma16mo ago
4 replies
AnandChowdhary

Prisma.DbNull doesn't work with Prisma Accelerate

Prisma Accelerate doesn't seem to support Prisma.DbNull. This is unexpected and production-breaking for us since we enabled Accelerate. For example, if you use Accelerate:

import { PrismaClient } from "@prisma/client/edge";
import { withAccelerate } from "@prisma/extension-accelerate";

export const db = new PrismaClient().$extends(withAccelerate());


And have a model with an option JSON property:

model User {
  id Int @default(autoincrement())
  info Json?
}


If you try and update the value to Prisma.DbNull, that value becomes an empty object {} rather than NULL in the database and that's what the .update also responds with.

db.user.update({
  where: { id: 1 },
  data: { info: Prisma.DbNull }
}); // { id: 1, info: {} }


I can confirm that this is indeed an issue with Accelerate, because when I disable it, it works correctly.
Was this page helpful?