ENV vars not been passed on build?
Hello, i'm currently building a Payload CMS & Next.js website, I'm trying to deploy the site to Railway but keep getting the following error.
Error: Error: missing secret key. A secret key is needed to secure Payload
Even though all my env vars are set. Anyone had a similar sort of issue?17 Replies
Project ID:
1c0a43f8-b799-450b-a357-77fe5d973c74
1c0a43f8-b799-450b-a357-77fe5d973c74
Are the env vars set on railway's "Service Variables" in your project settings?
Yeah
are you building with a dockerfile?
@Brody yeah
are you referencing the variable with
ARG VARIABLE_NAME
@Brody I don't reference any of the above variables in my docker file
then you should be lol
https://docs.docker.com/engine/reference/builder/#arg
Turns out adding them does nothing... pushing my
.env
file does fix the issue but this obviously isn't ideal.show me the updated dockerfile please
hmmm don't think you read the docs page I linked
either way, nixpacks should have no problem building a payload app, try temporarily removing or renaming the dockerfile
and for sure remove the .env file from the repo and make sure it's in your gitignore
Sorry just realised I didn't redo the file far enough, but I did use
ARG PAYLOAD_SECRET=xxx
already removed the .env
was just a tempory thing to see if it built. WIll try removing the docker file and re adding it again.let me know how that goes!
@Brody simple fix after all I just needed to move
ARG PAYLOAD_SECRET
before FROM base as runtime
nixpacks couldn't build your app?