Marc
Marc10mo ago

Monorepo vercel deploy

Is there a better approach to monorepo deploys on vercel than below. I feel like the CLI should just have a different command to grab the CONVEX_URL?
cd packages/backend && npx convex deploy --cmd 'echo NEXT_PUBLIC_CONVEX_URL=$CONVEX_URL > ../../.env' && cd ../.. && npm run build
cd packages/backend && npx convex deploy --cmd 'echo NEXT_PUBLIC_CONVEX_URL=$CONVEX_URL > ../../.env' && cd ../.. && npm run build
5 Replies
Convex Bot
Convex Bot10mo 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!
Marc
MarcOP10mo ago
I would like to avoid hardcoding CONVEX_URL since we want previews on PR's
Marc
MarcOP10mo ago
GitHub
v1/apps/app/vercel.json at main · get-convex/v1
An open-source starter kit based on Midday. Ported to Convex. - get-convex/v1
sshader
sshader10mo ago
Yep was about to mention --cmd-url-env-var-name -- without it, npx convex deploy tries its best to guess which env var to set, but it uses things like "does your package.json have next as a dependency" which probably don't work as well for some of the monorepo setups
Nicolas Quiroz
Nicolas Quiroz2mo ago
hey @sshader what if I have three vercel.json files in my monorepo? should I do the deploy in all three?

Did you find this page helpful?