Vercel Deployment Error

Yeah, It says It can't find the ENV for Deploy Key. But, Key is there present in the ENV Variables(I checked it) since the project was deployed 1st time and since then I'm daily pushing new code to my repo and build is working fine and its getting deployed. But, I got this error 1st time today.
10 Replies
Chandrabhan Singh
Chandrabhan SinghOP2mo ago
Key is present in ENVs
deen
deen2mo ago
it also shows you're not using the latest version of convex, and you're installing a beta version of next.js. this this intentional?
Chandrabhan Singh
Chandrabhan SinghOP2mo ago
Yeah, I'm using Next.js 16 beta. and I recently downgraded my convex to 1.27.0 to check whether it can work on this version or not. No, It's not intentional. I'm using next.js canary for many days and It was working completely fine. So, I don't think It's next's fault. I do have doubts about posthog-js and posthog-node, Not sure for now what is causing these build errors
Chandrabhan Singh
Chandrabhan SinghOP2mo ago
Hey, The issue is Fixed now. It looks like It was the EsLint at the core, who was creating these issues maybe Replaced Eslint with Ultracite and BOOM, everything works now. with all latest versions of convex, next.js etc https://www.ultracite.ai/
The AI-ready formatter that helps you write and generate code faste...
Ultracite is a zero- config Biome preset that provides a robust linting and formatting experience for your team and your AI integrations.
deen
deen2mo ago
I think it's more likely that your install cache was messed up on vercel, and reconfiguring your packages cleared the issue up. It's happened to me before, I don't really know it does, but deleting your lock file + node_modules and reinstalling has fixed it for me in the past
Chandrabhan Singh
Wow, didn't know about it. Your observation is likely true in this case. I just can't be sure what fixed it, But for now It's working. (Next time I'll clear the cache 1st if I run into such weird errors, Thanks) Hey, I faced the same issue again, I was getting the build errors during deployments on vercel only (not locally) and this time your solution fixed the problem.
The real problem here is that It's super hard and tricky to find the exact cause of this error, because in the build logs, we get errors that ENV variable for CONVEX_DEPLOY_KEY is not set, but it is actually available. & then you delete your node_modules+lock file and re-install them & suddenly the errors are gone. I'm not sure whether this error is caused with convex only, Or it happens with other backend frameworks as well on vercel? 🤔 But, It's really a confusing error, I want to make this solution publicly available for anyone who faces it. Do you have any idea how we can do that?
deen
deen2w ago
It's hard to tell what the problem really is, because you can't login to the vercel build environment to poke around and see what's wrong. I don't think it's caused by convex though, I think it's because the packages that vercel installs are somehow not the same as what is on your own system. But I've only experienced it on vercel with a long running convex project, that has seen hundreds of pushes to prod. What package manager do you use? Is it a monorepo? Did you install/update packages before it happened? I suspect there are many things that could cause this, but deleting lock file/node_modules is the nuclear option that wipes everything clean on both your environment and vercel's. It's even possible that your own dev environment was the one that was in a bad state - so it fails when vercel tries to build it.
Chandrabhan Singh
I'm using latest Bun and it's just a single next.js 16 app (no monorepo). & I did install some new packages before this push. But, this is 2nd time I got this same error. Maybe It happens coz I have multiple git branches on my remote repo and whenever I push to any branch It re-deploys the app using that branch and start causing these errors. Because, when I deleted the node_modules+lock file, I also merged the sub branch in my main and then I saw the error was resolved, so Maybe it's an issue of branch???.
deen
deen2w ago
I don't know 🙁
Chandrabhan Singh
Me neither, just some random assumptions 😭 But, I have strong feeling this error is caused by having different branches in your remote repo, coz I have two branches in my github repository, main and development. whenever I push some new code to development, vercel tries to deploy it and gives error, but whenever I merge the development into main, It deploys the same code without any error

Did you find this page helpful?