payloadcms / payloadcms/payload

promise.all-ing in a txn with vercel postgres fails

Open
#15,515 1 comment 2 reactions 1 assignee View on GitHub

@AlessioGr is already working on this.

Since Feb 4, 2026.

created-by: Contributor db: vercel-postgres
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

In summary, if you...

  • use @payloadcms/db-vercel-postgres
  • start a transaction with payloadClient.db.beginTransaction()
  • Promise.all() over some mutating payload queries such as payloadClient.update()
  • Call payloadClient.db.commitTransaction(transactionId)

No error will be thrown, but some of the queries in the transaction will not be reflected in the db.

I have created a minimal reproduction of this that can reliably show the issue. If you change the reproduction code to use @payloadcms/db-postgres the issue goes away.

The issue also occurs when calling update() with a where parameter. I think this is because it uses Promise.all under the hood. For this reason, I suspect this is related to #15403 and to #14247 where I opened a similar issue but made a mistake in my reproduction, and I didn't realize db-vercel-postgres was the root cause of the issue.

Link to the code that reproduces this issue

https://github.com/tau9-labs/payload-txn-repro-3/pull/1/changes

Reproduction Steps
  1. Pull the code at https://github.com/tau9-labs/payload-txn-repro-3/tree/minimal-repro
  2. Run pnpm i
  3. Run pnpm dev
  4. Visit localhost:3000/repro
  5. Click the Run Reproduction button a few times until it says "BUG REPRODUCED"

Alternatively, you can run pnpm reproduce to show the behavior

Which area(s) are affected?

db: vercel-postgres

Environment Info
pnpm payload info

> payload-txn-repro-3@1.0.0 payload /Users/chandler/Documents/tau9/payload-txn-repro-3
> cross-env NODE_OPTIONS=--no-deprecation payload info


Binaries:
  Node: 22.21.1
  npm: 10.9.4
  Yarn: N/A
  pnpm: 10.20.0
Relevant Packages:
  payload: 3.74.0
  next: 15.4.11
  @payloadcms/db-vercel-postgres: 3.74.0
  @payloadcms/drizzle: 3.74.0
  @payloadcms/graphql: 3.74.0
  @payloadcms/next/utilities: 3.74.0
  @payloadcms/richtext-lexical: 3.74.0
  @payloadcms/translations: 3.74.0
  @payloadcms/ui/shared: 3.74.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:41 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6031
  Available memory (MB): 36864
  Available CPU cores: 14

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.