milk enjoyer
milk enjoyer11mo ago

Issues with Vercel deployment

I am encountering something strange on Vercel. I am following this guide: https://docs.convex.dev/production/hosting/vercel I am very certain I have all the environment variables needed, but I am encountering some issues. When I include the CONVEX_DEPLOY_TOKEN, I get
Running "bunx convex deploy --cmd 'bun run build'"
401 Unauthorized: TokenInvalid: Token failed validation: InvalidComponents
Authenticate with `npx convex dev
Running "bunx convex deploy --cmd 'bun run build'"
401 Unauthorized: TokenInvalid: Token failed validation: InvalidComponents
Authenticate with `npx convex dev
` When I do not include the CONVEX_DEPLOY_TOKEN, I get:
Running "bunx convex deploy --cmd 'bun run build'"
✖ Vercel build environment detected but CONVEX_DEPLOY_KEY is not set. Set this environment variable to deploy from this environment. See https://docs.convex.dev/production/hosting
Running "bunx convex deploy --cmd 'bun run build'"
✖ Vercel build environment detected but CONVEX_DEPLOY_KEY is not set. Set this environment variable to deploy from this environment. See https://docs.convex.dev/production/hosting
I have attached some screenshots of my Vercel configuration.
No description
No description
22 Replies
milk enjoyer
milk enjoyerOP11mo ago
Strangely enough, I followed the same guide for another project previously and it worked as expected, I am not sure what could be the issue.
Michal Srb
Michal Srb11mo ago
Hey @milk enjoyer , are you sure you have copied the deploy key correctly from the dashboard? Can you try to replace it?
milk enjoyer
milk enjoyerOP11mo ago
yes, I just double-checked. I even created a new one and replaced it everywhere. I am using the dev key for preview environments by the way.
Michal Srb
Michal Srb11mo ago
Ah, can you try upgrading convex to 1.10.0-alpha.0 (https://www.npmjs.com/package/convex/v/1.10.0-alpha.0 )? It should include a fix.
npm
convex
Client for the Convex Cloud. Latest version: 1.9.0, last published: 6 days ago. Start using convex in your project by running npm i convex. There is 1 other project in the npm registry using convex.
milk enjoyer
milk enjoyerOP11mo ago
I get a new error now with this upgraded package:
bunx convex deploy
Error fetching GET https://provision.convex.dev/api/deployment/neighborly-lemming-986/team_and_project 401 Unauthorized: TokenInvalid: Token failed validation: InvalidComponents
Authenticate with npx convex dev
bunx convex deploy
Error fetching GET https://provision.convex.dev/api/deployment/neighborly-lemming-986/team_and_project 401 Unauthorized: TokenInvalid: Token failed validation: InvalidComponents
Authenticate with npx convex dev
I have double and triple-checked the CONVEX_DEPLOY_KEY too
Michal Srb
Michal Srb11mo ago
Do you have CONVEX_DEPLOYMENT set as well? Yeah, I see it in your list, can you remove it from production and preview?
milk enjoyer
milk enjoyerOP11mo ago
ok it works now after deleting it CONVEX_DEPLOYMENT was automatically set during convex init by the way so it might be confusing for users who simply copy and paste their .env over to vercel
Michal Srb
Michal Srb11mo ago
Yeah, the presence of CONVEX_DEPLOYMENT should not matter, we'll fix these bugs in 1.9.1 and 1.10 coming soon.
milk enjoyer
milk enjoyerOP11mo ago
All of a sudden I am getting this error
No description
milk enjoyer
milk enjoyerOP11mo ago
I tried adding CONVEX_DEPLOYMENT, but that brings back the previous error @Michal Srb
Michal Srb
Michal Srb11mo ago
@milk enjoyer are you definitely on the alpha version? 1.10.0-alpha.0
milk enjoyer
milk enjoyerOP11mo ago
Yes, I am definitely on 1.10.0-alpha.0. I solved the token invalid problem from before after i swapped to 1.10.0-alpha.0
Michal Srb
Michal Srb11mo ago
Hmm, the error would suggest that you don't CONVEX_DEPLOY_KEY set (which I assume you do)
milk enjoyer
milk enjoyerOP11mo ago
I do. But I removed CONVEX_DEPLOYMENT based on your recommendation which solved the previous build errors for me. by the way this exact same configuration has been working for me between Feb 15-16, only on Feb 17 this new error started happening out of nowhere (I did not change any packages or ENV variables between feb 15 to feb 17)
Michal Srb
Michal Srb11mo ago
Hey @milk enjoyer we published convex@1.9.1 which should hopefully resolve the deployment issues. Try it out and let me know how it goes.
milk enjoyer
milk enjoyerOP11mo ago
Ok, let me try it out now, thanks!
milk enjoyer
milk enjoyerOP11mo ago
I just upgraded, and it completely broke my codebase due to some supposed changes in the types
No description
milk enjoyer
milk enjoyerOP11mo ago
QueryCtx is just one example, I have 56 other things where the types are failing now after the upgrade
milk enjoyer
milk enjoyerOP11mo ago
No description
milk enjoyer
milk enjoyerOP11mo ago
I can confirm that downgrading back to 1.9.0 instantly solved all these type errors
Michal Srb
Michal Srb11mo ago
@milk enjoyer what is your project setup? convex-helpers has convex as a peer dependency, so after you install latest convex convex-helpers should be using it. Are you on the latest version of convex-helpers? Maybe try deleting your node_modules and reinstalling.
milk enjoyer
milk enjoyerOP11mo ago
Hmm indeed it seems like it was due to multiple different versions in my node_modeules. It works now thanks!

Did you find this page helpful?