burnstony#1975
burnstony#19755mo ago

CONVEX_DEPLOY_KEY monorepo

trying to deploy a Vite project from vercel I have a monorepo, because I also have native project I can't figure out what the right command cd apps/web-vite && pwd && npm run build && cd ../../packages/backend && pwd && npx convex deploy this deploys, but than I get this error "Uncaught Error: ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud'. at new Bw (client.js:51:13) at main.tsx:17:16"
7 Replies
burnstony#1975
burnstony#1975OP5mo ago
I have set CONVEX_DEPLOY_KEY in vercel I had to also set VITE_CONVEX_URL, than it works
sshader
sshader5mo ago
In the basic setup, you'd have something like npx convex deploy --cmd 'npm run build' where npx convex deploy would take care of setting VITE_CONVEX_URL for you based on your CONVEX_DEPLOY_KEY. (https://docs.convex.dev/production/hosting/vercel#how-it-works) This is particularly useful if you're using Convex preview deployments where the VITE_CONVEX_URL is different for each branch. Setting --cmd to something that changes directory to your web code and then runs npm run build might work. But if you're just doing production deploys, seems fine to just set VITE_CONVEX_URL in Vercel (what you've done already)
Using Convex with Vercel | Convex Developer Hub
Host your frontend on Vercel and your backend on Convex.
burnstony#1975
burnstony#1975OP5mo ago
Convex deploy only works from the packages/convex directory in the monorepo
Michal Srb
Michal Srb5mo ago
Yeah, we need to better support monorepos, I think it's going on the roadmap for next quarter
burnstony#1975
burnstony#1975OP5mo ago
thedevstockgirl
thedevstockgirl4mo ago
We finally got this working. We created an api folder that has all convex things. Also has a convex.json file at root pointing to the src folder. website folder also then has the same convex.json, but pointing to the api/src folder. We did not have to change the vercel deploy. which has the convex vercel deployment script. And everything still works. would be great to document this more clearly. I think I just stumbled on the convex.json file.
No description
No description
No description