payloadcms / payloadcms/payload
Payload scripts can exit before writing to disk
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
We run all sorts of CI scripts related to Payload. We use Turborepo to cache the outputs. This all works fine, but we started to have issues where sometimes dependent scripts would fail.
We debugged it to Payload scripts sometimes not writing the relevant file in time for Turborepo to pick it up. It seems that the Node.js process can exit before the file is written.
Link to the code that reproduces this issue
https://github.com/atimmer/payload-cli-startup-repro/
Reproduction Steps
Run this in the repro repository:
corepack enable
pnpm install
pnpm repro
What the repro script does:
- Delete the output file in testing.
- Run the payload script to generate a db schema
- Verify whether the file is present immediately after
On my machine this reproduces cleanly every time, but as it is a timing issue, it might not reproduce always for other machines.
Which area(s) are affected?
area: core
Environment Info
❯ pnpm --filter=ucms payload info
> ucms@1.0.0 payload /Users/anton/Code/Freave/MonoMisset/apps/ucms
> cross-env NODE_OPTIONS=--no-deprecation payload info
This project is configured to use pnpm because /Users/anton/Code/Freave/MonoMisset/package.json has a "packageManager" field
Binaries:
Node: 22.17.1
npm: 10.9.2
Yarn: N/A
pnpm: 10.33.0
Relevant Packages:
payload: 3.82.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Wed Nov 5 21:32:38 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T6031
Available memory (MB): 65536
Available CPU cores: 16
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.
Research direction
Start by running the linked reproduction with corepack enable, pnpm install, and pnpm repro, then trace the Payload script that generates the database schema. Done means the output file is present immediately after the script finishes, including in a regression test for the timing issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100