Vercel deployment fails when using `npx convex deploy --cmd '...'`
I've overridden the build command in Vercel when adding my project which is a basic Vite/React 19 project using Convex to be
npx convex deploy --cmd='vite build'
The error is:
However, when I change the build command to npx convex deploy && vite build
things seem to work okay. Is this okay or is the --cmd
option when calling convex deploy the ideal way?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!
From the error message you sent it looks like the codegen files are missing
We recommend that you commit the files in convex/_generated to your version control system (e.g. Git), is it the case in your project?
ah; understood. i thought it made sense to add convex/_generated to .gitignore maybe this is an assumption i made from earlier versions of convex
Also the difference between
npx convex deploy && npx vite build
vs. npx convex deploy --cmd='npx vite build'
(aside from deploy
adding the generated files) is that the latter will wait to deploy your Convex functions until the --cmd
succeeds.
If you had an error in the vite build
command, the &&
version would deploy the new version of your Convex functions but then your frontend build would fail and your users would be on an old frontend version but with the new Convex functions