stripe + process.env
For my app, process.env variable for Stripe are being picked up from development area in convex but not project wide default env variables. Does this happen with test keys only?
process.env.STRIPE_SECRET_KEY
6 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!
Project wide env vars only affect dev and preview deployments, not prod.
https://docs.convex.dev/production/environment-variables#project-environment-variable-defaults
If this is for your production deployment, you need to go the the settings for that department specifically.
Environment Variables | Convex Developer Hub
Store and access environment variables in Convex
Understood. I do want the env vars be picked up for preview deployments not prod.
Thank you for working late.
My problem is : I add variables in personal dev settings >> Environment Variables and my react app picks it up.
I add variables in the project settings >> Default Environment Variables and somehow my react app isn't picking them up
It did work yesterday...but a different behavior today so I am missing something
Humm... It's possible that you have not pushed since then. I think project level settings may not automatically get picked up, and require the dev deployment to be pushed once (i.e. run
npx convex dev
once).
I am not 100% about this.I'll report tomorrow on that, @Indy
project environment variables are defaults for newly created deployments, they're never applied to existing deployments
See this part of the doc:
These default values will be used when creating a new development or preview deployment, and will have no effect on existing deployments (they are not kept in sync).