Clever Tagline
Clever Tagline•4w ago

Launching dev, but it connects to production

I've been working on a personal app for a while now, and up until today when I've run npx convex dev it's been working with the dev deployment as it should. Today I fixed some things with the production deployment (Vercel), then opened the dev version to keep working on it and noticed that the app was showing the production data. 🤔 Rebooted VS Code. No change. Rebooted my computer. No change. The only thing I could find that felt odd was the state of the CONVEX_DEPLOYMENT and CONVEX_URL variables in .env.local. I thought that those were supposed to point to the dev deployment values, so I manually changed them. However, running npx convex dev just changed them back, and I'm back to square one. I'm stumped. Any ideas?
2 Replies
Clever Tagline
Clever TaglineOP•4w ago
I'm wondering if the fix that I had to apply to get the Vercel deployment working somehow messed up the local environment. In summary... * I changed from Remix to React Router a couple of months ago, but hadn't pushed a deployment in a while * Initially the deployment failed because I forgot to change the Vercel app config to expect the React Router framework instead of Remix. * Once that was fixed, the deployment failed because process couldn't be found. * Searching online, I found that the solution was to install @types/node as a dev dependency. * After installing that, deployment was successful. Could that installation of @types/node have affected how things work in dev mode for local testing? I can't believe this hack worked, but it's absolutely a hack, and I don't feel like I should rely on it too much. Now my .env.local looks like this at the top:
CONVEX_DEPLOYMENT=prod:xxxxx-yyy-381
CONVEX_URL=https://xxxxx-yyy-381.convex.cloud
CONVEX_DEPLOYMENT=prod:zzzzz-aaa-761
CONVEX_URL=https://zzzzz-aaa-761.convex.cloud
CONVEX_DEPLOYMENT=prod:xxxxx-yyy-381
CONVEX_URL=https://xxxxx-yyy-381.convex.cloud
CONVEX_DEPLOYMENT=prod:zzzzz-aaa-761
CONVEX_URL=https://zzzzz-aaa-761.convex.cloud
When I run npx convex dev it still forces the first pair to the production values. However, the second pair—which I set to the dev values—is thankfully left untouched. Because they come after the first pair, their values are used by the locally-running version of the app. I'd still like to figure out a "proper" solution, but this duct-tape fix is working for now.
Sara
Sara•4w ago
your terminal must be haunted, no other explanation

Did you find this page helpful?