P
Prisma5mo ago
Ryan

Transaction operations are not executing sequentially when using PrismaPlanetScale adapter

I've been working on upgrading our Prisma to v6 and leveraging some of the new features like driver adapters, specifically the PrismaPlanetScale adapter. After starting to use the PrismaPlanetScale adapter, I am getting an error when trying to execute multiple related operations in a transaction. For example, the following transaction errors:
await prisma.$transaction([
prisma.user.create({ data: { id, ... } }),
prisma.user.update({ where: { id }, data: { ... } })
])
await prisma.$transaction([
prisma.user.create({ data: { id, ... } }),
prisma.user.update({ where: { id }, data: { ... } })
])
The error is An operation failed because it depends on one or more records that were required but not found. No record was found for an update.
2 Replies
Prisma AI Help
Prisma AI Help5mo ago
You're in no rush, so we'll let a dev step in. Enjoy your coffee, or drop into #ask-ai if you get antsy for a second opinion!
Nurul
Nurul5mo ago
Are all of your transactions failing with this error or is this an intermittent error? Do you still get this error if you don't use PlanetScale adapter?

Did you find this page helpful?