Error: secretOrPrivateKey must have a value
Hi, locally registration is working for me, but when deployed to railway I'm getting error 500 on sign up. Looks like some env variable is missing or wasp reads it wrongly
13 Replies
Did you specify JWT_SECRET?
Oh thanks, I didn't. Now I saw in docs that it should be a random string. But why it worked on localhost then π€
Found why!
That's because in development mode it has JWT_SECRET specified
jwtSecret: 'DEVJWTSECRET'
https://github.com/wasp-lang/wasp/blob/main/waspc/data/Generator/templates/server/src/config.js#L41yep thanks @Fecony . We do set some envars automagically when running locally π
Ideally we would warn about this when deploying, that env var is missing! @miho I believe you created an issue for this, that suggest using Zod for this or something similar, right?
Yes, we are looking to validate the
env
variables and warn the user π@miho I wnated to link this convo to the relevant issue but I couldn't find one: I found this one https://github.com/wasp-lang/wasp/issues/175 which is somewhat old, and this one https://github.com/wasp-lang/wasp/issues/1067 which is a bit more focused on zod and not very verbose. Is there some newer / more specific issue we have for this, or should we use one of these?
Yep, I believe the newer one is the one we want π
env + Zod
π validate all the env variables and warn users in certain scenarios@miho I remember you had some ideas on this, and I think you know more about it than me -> could you then update the issue 1067 to have more details on it (our current idea / what we want) + link this convo to it?
Might even make sense to close 175 if we conclude 1067 is a super set of it.
We had an RFC π I'll link to it
Ah yes, I knew we had some info somewhere! Keep in mind RFC might not be public. I am not sure what is the best way then -> we can eithe rmake RFC public and link to it, or move the main conclusions from it to the GH issue, or smth.
Updated the issue with a link + some context that lives in the GH issue
Sounds good -> I would also consider updating the issue name, since I believe it is now more than just using Zod for env vars.