-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: JWT_SECRET
not working properly.
#214
Comments
Can it be possibily because the That would indicate that the JwtModule is being initialized before the config module is ready. Could you verify this? |
The JWT code I linked belongs from the auth module. And in the top level app module, config module is initialised at the very beginning. So I'm doubtful if that might be the cause (I checked it the first thing). |
@jamesfrye420 could you link the PR? The solution you showed would work for now. |
Sure, I just wanna check something before I push the pr. Will keep you updated |
@rajdip-b Is this solved ? if it is still open so i can work on this |
Not really, but this isnt a priority at the moment. |
Describe the bug
We have migrated to using zod for validating our env schema (refer #200). Recently, I have encountered an error where we can't log in due to
JWT_SECRET
not being fetched properly. Rest assured, I have double-checked on the paths and environmental variables to ensure that everything else is working.Note that, if I try
console.log(process.env.JWT_SECRET)
anywhere else in the code, it outputs the expected value without fault. The error seems to be occurring in theJwtModule
initialization inauth.module.ts
.Also note, if I use
process.env.JWT_SECRET ?? 'some-value'
in theJwtModule
registration code, it seems to work fine.To Reproduce
Steps to reproduce the behavior:
/api/auth/send-otp
endpoint to send an OTP to your email./api/auth/validate-otp
to validate your code.500 Internal Server Error
error in your response.Expected behavior
Screenshots
Response error:
Console log
Additional context
You can find the files in here:
The text was updated successfully, but these errors were encountered: