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
No description
No description
13 Replies
Fecony
Feconyβ€’2y ago
Did you specify JWT_SECRET?
fossfighter
fossfighterOPβ€’2y ago
Oh thanks, I didn't. Now I saw in docs that it should be a random string. But why it worked on localhost then πŸ€”
Fecony
Feconyβ€’2y ago
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#L41
shayne
shayneβ€’2y ago
yep thanks @Fecony . We do set some envars automagically when running locally πŸ‘
martinsos
martinsosβ€’2y ago
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?
miho
mihoβ€’2y ago
Yes, we are looking to validate the env variables and warn the user πŸ™‚
martinsos
martinsosβ€’2y ago
@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?
miho
mihoβ€’2y ago
Yep, I believe the newer one is the one we want πŸ˜„ env + Zod πŸ˜„ validate all the env variables and warn users in certain scenarios
martinsos
martinsosβ€’2y ago
@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.
miho
mihoβ€’2y ago
We had an RFC πŸ™‚ I'll link to it
martinsos
martinsosβ€’2y ago
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.
miho
mihoβ€’2y ago
Updated the issue with a link + some context that lives in the GH issue
martinsos
martinsosβ€’2y ago
Sounds good -> I would also consider updating the issue name, since I believe it is now more than just using Zod for env vars.
Want results from more Discord servers?
Add your server