Environment Variables Not Syncing to Backend Deployment
Hello Convex Support Team,
I am experiencing a critical issue where environment variables set in my project's dashboard are not being loaded into my backend functions.
The Problem:
My application requires a
STRIPE_SECRET_KEY
to process payments. I have set this variable correctly in the Convex dashboard under Settings -> Environment Variables. However, when my backend action (checkout:createCheckoutSession
) runs, the key is not present in process.env
.
Evidence from Logs:
We have added logging to the backend function to print all available environment variable keys. The STRIPE_SECRET_KEY
is consistently missing from this list. Here is a snippet from the server logs:
As you can see, the Stripe key is not included. This results in a "Stripe not configured" error, which stops our checkout process.
Troubleshooting Steps Taken:
1. Verified the variable name is spelled correctly (STRIPE_SECRET_KEY
).
2. Deleted and re-entered the key multiple times.
3. Confirmed we are using the correct Stripe Test Key (sk_test_...
).
4. Added a new, temporary environment variable (FORCE_REFRESH
) to try and force a full environment sync, but this new variable also did not appear in the logs.
This strongly indicates a platform-level synchronization issue between the dashboard settings and the running backend environment.
Could you please investigate the environment variable synchronization for my project and ensure that the variables I set in the dashboard are correctly loaded into the backend?
Thank you for your help.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!
Hello Convex Support TeamJust a reminder, this is the community support channel. While the Convex devs do help on occasion, there's no guarantee that they'll get to every thread.
I have set this variable correctly in the Convex dashboard under Settings -> Environment Variables.You didn't mention if you did this in both the dev and production environments for your project. They each have independent variables. The dev environment is for local testing (
npx convex dev
), and the production environment is for your deployed app. You'll need to set the same environment variable in both places.