Repository navigation
Labels
Description
Describe the Bug
When I attempt to access the admin page, a module resolution error occurs and I am unable to open it.
Module not found: Can't resolve 'worker_threads'
4 | const split = require('split2')
5 | const { Duplex } = require('stream')
> 6 | const { parentPort, workerData } = require('worker_threads')
| ^
7 |
8 | function createDeferred () {
9 | let resolve
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/.pnpm/[email protected]/node_modules/pino-pretty/index.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/utilities/logger.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/index.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/utilities/getEntityPermissions/entityDocExists.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/utilities/getEntityPermissions/getEntityPermissions.js
./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/payload/dist/exports/internal.js
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_j5wrcln45qasuerzxq2joth2fq/node_modules/@payloadcms/plugin-cloud-storage/dist/utilities/resolveSignedURLKey.js
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_j5wrcln45qasuerzxq2joth2fq/node_modules/@payloadcms/plugin-cloud-storage/dist/exports/utilities.js
./node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_@babel+co_oztnqrx4zsk7tam7jwxz3aurv4/node_modules/@payloadcms/storage-r2/dist/client/R2ClientUploadHandler.js
GET /admin 500 in 10882ms
Link to the code that reproduces this issue
Reproduction Steps
I have provided a link to the repository, but it is just the state immediately after running create-payload-app.
pnpx create-payload-app -t with-cloudflare-d1pnpm dev- access http://localhost:3000/admin
Which area(s) are affected?
plugin: cloud-storage
Environment Info
Binaries:
Node: 24.15.0
npm: 10.9.2
Yarn: 1.22.19
pnpm: 9.15.9
Relevant Packages:
payload: 3.85.0
next: 15.4.11
@payloadcms/db-d1-sqlite: 3.85.0
@payloadcms/drizzle: 3.85.0
@payloadcms/graphql: 3.85.0
@payloadcms/next/utilities: 3.85.0
@payloadcms/plugin-cloud-storage: 3.85.0
@payloadcms/richtext-lexical: 3.85.0
@payloadcms/storage-r2: 3.85.0
@payloadcms/translations: 3.85.0
@payloadcms/ui/shared: 3.85.0
react: 19.2.1
react-dom: 19.2.1
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Available memory (MB): 31885
Available CPU cores: 16
Reacted by Quang Ln, Michael Drayer, Larra Su, Klas, Niels Reijnders , esprimo, daniel hegyi, Kevin Van Ransbeeck, Leander Gilles, Lucas Arusiewicz Lacerda and 2 more
Activity
jmtorres commentedon Jun 1, 2026
Confirming the same failure on
@payloadcms/[email protected]— pinning back to3.84.1resolves it. So this isn't R2-specific; any storage adapter whoseClientUploadHandlerimports from@payloadcms/plugin-cloud-storage/exports/utilitieswill hit it.Root cause
The regression comes from #16495 (and its 3.x backport #16510), which adds
resolveSignedURLKeyand re-exports it frompackages/plugin-cloud-storage/src/exports/utilities.ts.The
*ClientUploadHandlerfiles already import from that barrel, so even though they never callresolveSignedURLKeydirectly, importing the barrel pulls it in — which transitively drags into the client bundle:payload/exports/internalpayload/utilities/logger→pino-pretty→worker_threadspayload/uploads/safeFetch→undici→node:assert,node:async_hooks,node:buffer, …Worth noting that #16495 only modified the R2 / S3 / Azure / GCS client handlers, not
VercelBlobClientUploadHandler— so vercel-blob is regressing purely because of the barrel addition, not because its own code changed.Suggested fix
The underlying dedup fix in #16495 is solving a real data-integrity bug and shouldn't be reverted. The issue is just that
resolveSignedURLKey(server-only, needs DB access) is sharing a barrel with client-safe utilities likeupdateFilename.Splitting
exports/utilitiesinto a client-safe barrel and a server-only barrel — or movingresolveSignedURLKeyout of the shared one — would resolve this without losing the fix.cc @AlessioGr — flagging since you have the full context from #16495 on why
resolveSignedURLKeylives where it does.mdrayer commentedon Jun 5, 2026
Ditto here for
@payloadcms/storage-vercel-blob. A blocker for us from using payload v3.85.0.louis-sicko commentedon Jun 16, 2026
any update? i want to migrate to payload but this is currently a huge roadblock.
shimjudavid commentedon Jun 19, 2026
tired of trying several options to deploy payloadcms on cloudflare. 5 hrs spend, no results. It sucks really!
louis-sicko commentedon Jun 19, 2026
Yeah I rolled my own CMS built on cloudflare with multitenancy. I wasnt happy with the multi tenant implementation
jimmy-yu-UU commentedon Jun 22, 2026
Same issue here, please fix this.
fix(plugin-cloud-storage): split client and server utility exports (#…
github-actions commentedon Jul 1, 2026
🚀 This is included in version v3.85.2