Whist testing the Next Preview example (
https://github.com/payloadcms/payload/tree/master/examples/preview) everything works great locally, but when attempting to build locally or deploy to Railway/Vercel, yarn errors out code 1.
The example config includes this line
cors: [process.env.PAYLOAD_PUBLIC_SERVER_URL, process.env.PAYLOAD_PUBLIC_SITE_URL],
And console tells me the strings are loading from ENV normally within both config and server, eg.
I feel like I am missing something obvious here…
The plot thickens, process.env.PAYLOAD_PUBLIC_SERVER_URL and process.env.PAYLOAD_PUBLIC_SITE_URL are undefined on build.
It seems the build command does not append the .env like dev does. PAYLOAD_PUBLIC_SITE_URL, PAYLOAD_PUBLIC_SERVER_URL, MONGODB_URI, PAYLOAD_SECRET, REVALIDATION_KEY, COOKIE_DOMAIN are all missing. I have added these when deploying to Railway, but get the same error regardless. Any ideas?
Have you seen @Alessio 🍣's post? I think it might be exactly what you are looking for!
https://discord.com/channels/967097582721572934/1091055191664623636/1091056141141819422
Railway envs
I will take a look. I started down the rabbit hole of using Railway reference ENV
${{VAR}}
to feed them in, but switched to Payload cloud immediately upon beta release 😎
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.