Cannot find Payload config 500 errors with Next.js on Vercel

default discord avatar
wiggindev
2 weeks ago

Started a fresh Next.js app and downgraded to 13.5.6, installed next-payload and payload and ran

yarn next-payload install

. I also moved my payload config to my root directory and updated the env variable and

withPayload

config. After deploying to Vercel and opening

/admin

, I get 500 errors from

/api/users/init

,

/api/users/me

,

/api/payload-preferences/nav

with this error:



Error: cannot find Payload config. Please create a configuration file located at the root of your current working directory called "payload.config.js" or "payload.config.ts"



payload 2.1.1


@payloadcms/next-payload 0.1.9


@payloadcms/db-postgres 0.1.13


@payloadcms/richtext-slate 1.1.0


next 13.5.6



EDIT: confirmed that the config path is set correctly per this conversation

https://discordapp.com/channels/967097582721572934/1164523079955910760/1164523079955910760


This was solved by added the

PAYLOAD_CONFIG_PATH

environment variable in Vercel

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.