Can't start local development deployment due to missing environment variable
Hi, we would like to get local development deployments working for our repository in order to easily spawn background agents.
Regular development deployments work well, but when I try to run
npx convex dev --local --once
I get the following error:
Looking at this module, the code that's causing this is
which is located at the root of the module.
This works fine in a cloud deployment, where it's possible to push the code first and after that set the environment variable.
We will look into refactoring the code in order to also make it work with local development deployment, but it would be great if this could work the same as in cloud development deployments.4 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!
Does this also apply to new local development deployments? Because we do have this environment variable set as a default

Hi @Jules! I tried to reproduce your issue locally and I could make it work with the following actions:
• Start a local dev server without
--once
• After you get the error message, use the npx convex env set
command to set the missing environment variable
• This unblocks convex dev
Also I checked and “Default Environment Variables” are ignored by local dev deployments at the momentGreat thanks!