-
Notifications
You must be signed in to change notification settings - Fork 42
Error when running admin in production #38
Comments
Hey @paulpopus — I just spent a good 4 hours trying to figure out what the hell was going on here and unfortunately I figured it out, although the answer upsets me greatly. Just add https://github.com/payloadcms/next-payload-demo/blob/main/payload/components/UITest/index.tsx#L1 This is unfortunately something in the NextJS world that we can't do much to help. But happy to have found a workaround 😌 |
@jmikrut So I'm actually getting this error when trying to access the admin panel in production. I'm not importing payload's own components anywhere and the weird part is that locally it works totally fine This is the page component 'use client'
import React from 'react'
import Root from 'payload/dist/admin/Root'
const PayloadAdmin = () => {
const [mounted, setMounted] = React.useState(false)
React.useEffect(() => {
setMounted(true)
}, [])
if (!mounted) return null
return <Root />
}
export default PayloadAdmin I'm on the latest version of nextjs and next-payload package. When I'm accessing the admin panel it's making requests to the API for endpoints import handler from '@payloadcms/next-payload/dist/handlers/[collection]/init'
export default handler
export const config = {
api: {
externalResolver: true
}
} |
Can you check your Vercel logs? You should be able to find an error that is causing the 500 and we can help with that for sure. I wonder if Payload is able to connect to your database appropriately. Let me know! |
Yeah so that's the error that I posted above,for payload version
runtime:
function:
|
@jmikrut @paulpopus I'm having the exact same issue when running a |
@jmikrut managed to find what's going on. I'm using the "payload-visual-editor" plugin which includes a custom field. I think that this might be the same problem as the one you mentioned earlier. However, I can't simply add a Edit: Managed to fix it! if you add a third party package to the Perhaps a useful thing to include in the documentation 😄 |
Hey @DennisSnijder you should add that package to transpilePackages in your next.config.js - that will solve the issue 👍 |
I just did that! it works 🥳 |
This worked for me too. I was using the formbuilder plugin. Would indeed be nice if this was added to the docs. |
Currently pinning the Next version due to the breaking change in the latest version of Next, so I can't say if fixing that other issue will fix this too but when running in production, serverless in Vercel, the admin panel doesn't load due to several errors like this one
The text was updated successfully, but these errors were encountered: