Can't deploy to Vercel with Next.js
When I push to vercel and it runs the "npx convex deploy --cmd 'bun run build'", it keeps giving me nextjs's node api errors and telling me to add use node directives but thats for the frontend no?
I added "use node" to my convex routes anyways but still nothing works
6 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!
You're probably importing something from one of your nextjs node api files into a convex file, or from a file that imports from one of those files somewhere up the chain.
ok i got that to work, but does convex currently support a vercel build cache?
it seems like if i redeploy with changed env keys or whatever non-code base change it is, it wont use the build cache
Convex cli shouldn't change the behavior of what
bun run build
does as far as I know. If you're seeing this any details you have would be helpful.Sentry doing its stuff is expected - but as you can see "bun run build" is being executed again
Without convex, the cmd "bun run build" wont actually be executed at all on vercel, it will recognise it was already ran prior and ignore that.
With convex, because npx convex deploy is actively executing the cmd "bun run build", it makes sense for it to run twice
But what I wanted to happen was "npx convex deploy --cmd "bun run build" to not execute at all. just like prior to not having convex
Vercel should detect the inputs havent changed, so nor should the outputs
Not sure if this is a convex or vercel issue, but I hope this stuff helps
If your build command is
npx convex deploy --cmd "bun run build"
and nothing more, it won't run twice. So that second run is coming from somewhere else.
Vercel's build caching shouldn't behave any differently with Convex in use.