Type safe environment variables
Is it possible to get type safety for environment variables, so that my app only builds if I have added all required environment variables to convex, similar to T3 Env for regular next.js/vercel deployments?
2 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
T3 will actually produce this result for you in Convex, I assume you would use the "Agnostic Core" approach.
But more essentially, if importing any file in your Convex directory causes an error, your deployment will fail with the thrown error. So if you check for an environment variable and throw if it's not defined, the deployment will fail with whatever error your throw.