You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Config returns null in production build (Next.js 16 + Turbopack RSC) #15429
PayloadCMS Config Returns null in Production Build (Next.js 16 + Turbopack)
Environment
PayloadCMS: 3.73.0 (latest, with Next.js 16 support)
Next.js: 16.2.0-canary.17 (meets >16.1.1-canary.35 OR 16.2.0+ requirement)
React: 19.2.4
Runtime: Bun 1.3.8 (also reproduced with Node 22)
Database: PostgreSQL via @payloadcms/db-postgres
Bundler: Turbopack (Next.js 16 default)
Build Target: Docker production build
Summary
When running PayloadCMS in a Next.js 16 production build with Turbopack, the Payload config object returns null when imported in React Server Component context, specifically in the (payload)/layout.tsx file. This causes the admin panel to fail with an RSC error.
Please add a reproduction in order for us to be able to investigate.
Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.
Why was this issue marked with the invalid-reproduction label?
To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).
To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.
Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.
I added a link, why was it still marked?
Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.
I tested 16.2.0-canary.16 as suggested, but encountered a different error during the build:
Error: Failed to load external module @payloadcms/next-63b069c48ca83adb/layouts:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".css" for
/app/node_modules/react-image-crop/dist/ReactCrop.css
This appears to be a Turbopack issue with CSS imports in externalized packages. The build gets further than with .17 (which had the config null runtime error), but now fails during page data collection when trying to import CSS from react-image-crop.
With 16.2.0-canary.17: Config returns null at runtime (original issue) With 16.2.0-canary.16: Build fails with CSS import error
Should I try an even earlier canary, or is there a different approach for PayloadCMS + Turbopack production builds?
✅ Build Success: Webpack successfully compiled the production build and generated static pages in ~11s.
❌ Runtime Failure: The admin interface still fails to load with a TypeError.
Webpack Runtime Error:
TypeError: Cannot destructure property 'admin' of 'q' as it is undefined.
(Where 'q' is the minified config object).
Conclusion:
This confirms the issue is not bundler-specific. Both Turbopack and Webpack exhibit similar failures when loading the Payload configuration in a production RSC context with Next.js 16. This points towards a core incompatibility in how the configuration is being loaded/shared in this environment.
Should I try downgrading to Next.js 15 to help isolate if this is a regression specific to Next.js 16? .
Following up on my question about downgrading to Next.js 15 - I've tested with Next.js 15.1.6 (stable) and can confirm the issue persists with the exact same error:
TypeError: Cannot destructure property 'admin' of 'H' as it is undefined.
at dG (.next/server/app/(payload)/admin/[[...segments]]/page.js:9:136607)
This confirms the issue is not a Next.js 16 regression but affects PayloadCMS production builds on both Next.js 15 and 16.
Environment Details:
Next.js: 15.1.6 (stable)
PayloadCMS: 3.73.0
Bundler: Tested with both Webpack and Turbopack (same result)
Deployment: Kubernetes production environment
The route handlers are also failing with "No response is returned from route handler" errors because they encounter the config error and can't return a proper Response object.
Is there a known workaround or ETA on a fix? This is blocking production deployment.Next.js 15 Test Results
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".css" for
This is an error in your project - it means you're importing client code into your payload config somewhere which is not allowed, since the payload config has to be node-safe.
Activity
github-actions commentedon Jan 30, 2026
Please add a reproduction in order for us to be able to investigate.
Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.
Why was this issue marked with the
invalid-reproductionlabel?To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with
create-payload-app@latest -t blankor a forked/branched version of this repository with tests added (more info in the reproduction-guide).To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.
Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.
I added a link, why was it still marked?
Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.
Useful Resources
AlessioGr commentedon Jan 30, 2026
Can you try if
16.2.0-canary.16works?TheGenXCoder commentedon Jan 30, 2026
Thanks for the quick response @AlessioGr!
I tested
16.2.0-canary.16as suggested, but encountered a different error during the build:This appears to be a Turbopack issue with CSS imports in externalized packages. The build gets further than with
.17(which had the confignullruntime error), but now fails during page data collection when trying to import CSS fromreact-image-crop.With 16.2.0-canary.17: Config returns
nullat runtime (original issue)With 16.2.0-canary.16: Build fails with CSS import error
Should I try an even earlier canary, or is there a different approach for PayloadCMS + Turbopack production builds?
TheGenXCoder commentedon Jan 30, 2026
Update: Webpack testing confirms issue is NOT bundler-specific
I tested forcing webpack instead of Turbopack to isolate the problem:
Configuration:
Results:
TheGenXCoder commentedon Jan 30, 2026
Supplementary Update: Full Webpack Testing Results
It seems my previous comment was truncated. Here are the full findings from the webpack testing:
Configuration used to force Webpack:
Test Results:
TypeError.Webpack Runtime Error:
(Where 'q' is the minified config object).
Conclusion:
This confirms the issue is not bundler-specific. Both Turbopack and Webpack exhibit similar failures when loading the Payload configuration in a production RSC context with Next.js 16. This points towards a core incompatibility in how the configuration is being loaded/shared in this environment.
Should I try downgrading to Next.js 15 to help isolate if this is a regression specific to Next.js 16? .
TheGenXCoder commentedon Jan 30, 2026
Next.js 15 Test Results
Following up on my question about downgrading to Next.js 15 - I've tested with Next.js 15.1.6 (stable) and can confirm the issue persists with the exact same error:
This confirms the issue is not a Next.js 16 regression but affects PayloadCMS production builds on both Next.js 15 and 16.
Environment Details:
AlessioGr commentedon Feb 13, 2026
This is an error in your project - it means you're importing client code into your payload config somewhere which is not allowed, since the payload config has to be node-safe.
As for Next.js 15.1.6, this version is not supported by Payload. Could you share a reproduction repo (https://github.com/payloadcms/payload/blob/main/ISSUE_GUIDE.md) for this problem using a supported Next.js version? I recommend either 15.4.11, or the latest Next.js 16.2.x canary
Fix blank admin panel: force webpack for production build
Build with webpack instead of Turbopack
Build on Vercel with webpack, not Turbopack