mwarger
mwarger•2mo ago

local deployment not working?

I'm trying to run npx convex dev --local and as far as I understand from here (https://docs.convex.dev/cli/local-deployments) this should start a local development environment on my machine (localhost) and allow me to run the backend locally. However, all I see in the console is a link to the dashboard at View the Convex dashboard at https://dashboard.convex.dev/d/my-dev-name-123 (which is the same as my existing cloud deployment). I guess I would expect to see the URL there be for localhost somehow. The env file it seems to create also just has a URL that is my existing cloud deployment - I expect I would want to see a localhost URL of some kind. Is this incorrect? Like others, I've made sure to be running node 18 to try this out.
As a side note - I'm also confused as to what the --once flag is for, considering it seems to immediately exit. Could someone clarify what the expected workflow is? Am I missing something? Please let me know if there's some specific information I can provide.
Thank you!
Local Deployments for Development | Convex Developer Hub
Instead of syncing code to a Convex dev deployment hosted in the cloud, you can
Convex Dashboard
Manage your Convex apps
11 Replies
Convex Bot
Convex Bot•2mo 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!
mwarger
mwargerOP•2mo ago
Bumping this. Does that work in discord? 😛
ballingt
ballingt•2mo ago
@mwarger Yes this is a known issue: if you already have a cloud dev, specifying --local doesn't work. I have a TODO for this, but as a workaround you can run npx convex dev --configure and you'll get the chance to choose again.
As a side note - I'm also confused as to what the --once flag is for, considering it seems to immediately exit. Could someone clarify what the expected workflow is?
--once is for "push the code once, and don't keep watching afterward"
mwarger
mwargerOP•2mo ago
@ballingt thanks so much for your reply. I think this makes sense. So, for example, can/should I lean on this to have branches run locally and have a develop branch use the cloud deployment? Can I separate local and cloud deployment this way?
ballingt
ballingt•2mo ago
You could, they're separate deployments (separate DB/code/scheduled jobs/etc.) but switching between them isn't the easiest. We're working on being able to do this more nicely, as many development deployments as you want. What do you mean a "develop" branch, like staging? is your develop branch for developing a different feature, or for running all your features? Either way, you could do but it's messy.
mwarger
mwargerOP•2mo ago
yeah, so in general I keep develop using my cloud dev environment, and main for production. i use feature branches for development as well, but I sometimes have multiple of them with schema changes in each one, and that gets messy dealing with all of them having data (or not) in the cloud dev environment, and dealing with making sure things are synced or seeded there. i was considering these local deployments as a way to keep feature branches as separate local dev environments, which i could get to the finish line, then merge to develop where I integrate the changes. I know preview deployment exists, but I didn't want to bother with that necessarily (the deployment part) but maybe that's the better approach here...
ballingt
ballingt•2mo ago
Just to confirm what "develop" is, is it like a staging branch? There's not much better here (although do check out preview deployments, they let you have multiple features at once!), you can have multiple local deployments though. Coming down the pipe will be the ability to have multiple named cloud dev deployments! And would love feedback on the local stuff if you use it that way, similarly that switching interface could be improved.
mwarger
mwargerOP•2mo ago
yeah, develop is pretty much a staging branch. it's the main integration point for a lower environment before it's moved to production.
Charlie Lamb
Charlie Lamb•3w ago
hey has this been resolved yet?
ballingt
ballingt•3w ago
--local not working for a project when you already have a cloud deployment, no. You need to create the deployment locally in the first place, or use npx convex dev --configure --dev-deployment=local not decided yet whether to deprecate that flag or make it work wiht some reasonable behavior here's the issue https://github.com/get-convex/convex-js/issues/70
Charlie Lamb
Charlie Lamb•3w ago
sweet thanks mate

Did you find this page helpful?