payloadcms / payloadcms/payload
Common virtual field crashes sub-requests in the same transation
Open
@r1tsuu is already working on this.
Since Mar 13, 2026.
area: core
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
Basic configuration setup:
- A Tenants collection -> each document is linked to a tenant and has a virtual field
tenant.slug. - Pages are linked to Sites via a relationship
- Sites link pages through a join
- Pages fetches Sections in an afterRead hook
The issue arise when fetching a site with depth of at least 1, and when the sections fetch in the page afterRead is done in the same transaction (passing req to payload.find). The requests never completes.
When removing the tenant.slug virtual field from either Sites or Sections the issue is gone (same when just excluding the field via select). This problem doesn't happen in the REST API.
Link to the code that reproduces this issue
https://github.com/Xmaster6y/bug-virtual
Reproduction Steps
Based on the given reproduction that comes with a seed:
- Populate the required env variables (postgres or sqlite)
- Execute the failing script:
npx tsx src/scripts/depth.ts - Observe that for postgres the request hangs indefinitely while for sqlite it quietely fails or hangs.
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 24.8.0
npm: 11.11.0
Yarn: 1.22.22
pnpm: 10.17.0
Relevant Packages:
payload: 3.78.0
next: 15.4.11
@payloadcms/db-postgres: 3.78.0
@payloadcms/db-sqlite: 3.78.0
@payloadcms/drizzle: 3.78.0
@payloadcms/graphql: 3.78.0
@payloadcms/next/utilities: 3.78.0
@payloadcms/richtext-lexical: 3.78.0
@payloadcms/translations: 3.78.0
@payloadcms/ui/shared: 3.78.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:29:54 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T8122
Available memory (MB): 16384
Available CPU cores: 8
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.