Can't run `npx convex dev` in a nextjs app
Hi! I'm trying to add convex to an existing NextJS app hosted on vercel, following this guide: https://docs.convex.dev/quickstart/nextjs
I pnpm installed convex locally, but when I run
npx convex dev
I get this error:
✖ 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 tried setting a CONVEX_DEPLOY_KEY in my production env var on vercel, but the error is local and I don't think I'm supposed to add a CONVEX_DEPLOY_KEY locally?5 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!
hmm. yeah, I wonder why it's detecting a "Vercel build environment"
is VERCEL defined in the environment for some reason on your machine?
https://github.com/get-convex/convex-js/blob/main/src/cli/lib/envvars.ts#L260
looks like yes.
I think I did a
vercel env pull
at some point in the past and it added these:
got it
yeah, that VERCEL=1 is making our lib think this is building in vercel's infra
ok yeah, If I delete VERCEL="1", it works
I just tried another
vercel env pull
and it deleted all of those:
maybe the vercel behavior changed here, not sure. in any case, I think I'm unblocked now, thanks!