msanie
msanie2w ago

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:
'Available environment variable keys:' [
'PATH',
'PWD',
'LANG',
'NODE_PATH',
'TZ',
'AUTUMN_SECRET_KEY',
'CONVEX_CLOUD_URL',
'CONVEX_SITE_URL',
'JWKS',
'JWT_PRIVATE_KEY',
'RESEND_API_KEY',
'SITE_URL',
'VLY_APP_NAME'
]
'Available environment variable keys:' [
'PATH',
'PWD',
'LANG',
'NODE_PATH',
'TZ',
'AUTUMN_SECRET_KEY',
'CONVEX_CLOUD_URL',
'CONVEX_SITE_URL',
'JWKS',
'JWT_PRIVATE_KEY',
'RESEND_API_KEY',
'SITE_URL',
'VLY_APP_NAME'
]
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
Convex Bot
Convex Bot2w ago
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!
Clever Tagline
Hello Convex Support Team
Just 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.

Did you find this page helpful?