Deployment differences between Convex and Vercel
My current project is built with Next.js, using Convex as the database and Vercel for deployment.
We’re experiencing deployment issues in production caused by a mismatch in the build timing between Convex and Vercel. Specifically:
Convex finishes building first — for example, removing a function.
Then, Vercel builds and deploys the React app that still references that function.
During the ~1.5-minute gap (or longer if a build fails), the function no longer exists on Convex, but the frontend still tries to call it. This causes runtime errors and crashes in all processes that rely on it.
Is there a known workaround or recommended approach to handle this build-order issue between Convex and Vercel? Any insights would be greatly appreciated.
11 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!
Yes, we're using the deploy command.
That command runs your frontend build first, then runs the Convex build after
or rather the convex push/deploy
again, asking not just if you're using the deploy command, but if you're using it as documented for production, eg., passing your frontend build command in via
--cmd rather than running your own frontend build command separately, so something like:
this is our build command (scripts>build = "npx convex deploy --check-build-environment disable --cmd 'next build'")
so vercel deploys by calling the build script.
what you're saying is that we should run build script as "next build" only and another script function must be called, for example scripts>deploy to run "npx convex deploy --check-build-environment disable --cmd 'npm run build'"?
No it's find to call next build directly as the build command if you want
Convex finishes building first — for example, removing a function. Then, Vercel builds and deploys the React app that still references that function.Can you help me understand how you came to the conclusion that this is happening
Yes, this is what hapened:
1. We deployed a new feature (that also removed a deprecated convex query) to our staging environment, got tested, then pushed into production
2. While promoting our new main deploy to production we received support calls saying that some request were failing in the frontend
3. During that 3 minute window we stopped the promotion process and started debugging
4. We found out that the request that were failing tried to access this deprecated convex query
5. Our temporally solution was not to remove the deprecated convex query on our new feature and remove it after promotion.
In this case is a removal, but in other cases such as renaming tables or columns may not be this easy to solve.
We deployed a new feature (that also removed a deprecated convex query) to our staging environment, got tested, then pushed into production"pushed into production" - was that done with the command that includes your frontend build? Your frontend build should have failed from types alone with the missing function
How did you solve this @fede ? I am seeing something similar but different - released a new query, tested locally, released to production (Vercel command is : npx convex deploy --cmd 'next build') and yet, the query isn't being triggered by my production 'app'
Did you have to change regenerate a deployment key?
Never mind, I resolved it.
how ?
I wasn't able to resolve it and we're still having issues about it. @uma would you mind sharing your solution?