🤔 Error validating serverEnv

I just wired up next-auth, and while trying to access my new auth routes, i get an invalid environment variables error. oddly enough when I run printenv all of the variables seem to be populated. Furthermore, when i log out the _serverEnv variable the validation seems to have passed. I'm sure I'm missing something here as this is my first time working with zod and validating my env. So I've also included a screenshot of my editor configuration as well.
10 Replies
Gaurang
Gaurang•3y ago
Gaurang
Gaurang•3y ago
regardless i still get an error thrown. NOTE: I am able to render my static pages, this just seems to be an issue on next-auth custom pages. still haven't been able to figure this out. when try to log out env variables from an SSR route, they actually don't exist. but logging them from the env/server.mjs file they're all show up. trying to work backwards and see if i can figure out where in the pipe the issue is occurring
julius
julius•3y ago
try changing this line to be _serverEnv.success === false https://github.com/t3-oss/create-t3-app/blob/1cc67350c626db3c67f012a84d1a73a7a0f03a91/cli/template/base/src/env/server.mjs#L11 i think that fixed it for some people on v5 but seems to have gotten lost in v6
Gaurang
Gaurang•3y ago
Thanks so much for the reply, I thought I tried that earlier, will give it another go this evening.
Gaurang
Gaurang•3y ago
That did not actually help now that I recall -- still haven't changed it back.
Gaurang
Gaurang•3y ago
It seems that _serverEnv.success check is actually failing when i navigate to this particular route (/auth/signin)
Gaurang
Gaurang•3y ago
Gaurang
Gaurang•3y ago
GitHub
GitHub - gaurangrshah/env-test
Contribute to gaurangrshah/env-test development by creating an account on GitHub.
Gaurang
Gaurang•3y ago
Just created a repoduction, if anyone is willing to test. thanks!
Gaurang
Gaurang•3y ago
GitHub
bug: Invalid environment variables · Issue #624 · t3-oss/create-t3-...
Provide environment information System Info: System: OS: macOS 12.5 CPU: (8) arm64 Apple M1 Memory: 129.66 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.20.0 - ~/.nvm/versions/node/v14.20...
Want results from more Discord servers?
Add your server