holden
holden4w ago

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
Convex Bot
Convex Bot4w ago
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!
jamwt
jamwt4w ago
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
holden
holdenOP4w ago
looks like yes. I think I did a vercel env pull at some point in the past and it added these:
VERCEL="1"
VERCEL_ENV="development"
VERCEL_GIT_COMMIT_AUTHOR_LOGIN=""
VERCEL_GIT_COMMIT_AUTHOR_NAME=""
VERCEL_GIT_COMMIT_MESSAGE=""
VERCEL_GIT_COMMIT_REF=""
VERCEL_GIT_COMMIT_SHA=""
VERCEL_GIT_PREVIOUS_SHA=""
VERCEL_GIT_PROVIDER=""
VERCEL_GIT_PULL_REQUEST_ID=""
VERCEL_GIT_REPO_ID=""
VERCEL_GIT_REPO_OWNER=""
VERCEL_GIT_REPO_SLUG=""
VERCEL_URL=""
VERCEL="1"
VERCEL_ENV="development"
VERCEL_GIT_COMMIT_AUTHOR_LOGIN=""
VERCEL_GIT_COMMIT_AUTHOR_NAME=""
VERCEL_GIT_COMMIT_MESSAGE=""
VERCEL_GIT_COMMIT_REF=""
VERCEL_GIT_COMMIT_SHA=""
VERCEL_GIT_PREVIOUS_SHA=""
VERCEL_GIT_PROVIDER=""
VERCEL_GIT_PULL_REQUEST_ID=""
VERCEL_GIT_REPO_ID=""
VERCEL_GIT_REPO_OWNER=""
VERCEL_GIT_REPO_SLUG=""
VERCEL_URL=""
jamwt
jamwt4w ago
got it yeah, that VERCEL=1 is making our lib think this is building in vercel's infra
holden
holdenOP4w ago
ok yeah, If I delete VERCEL="1", it works I just tried another vercel env pull and it deleted all of those:
- VERCEL
- VERCEL_ENV
- VERCEL_GIT_COMMIT_AUTHOR_LOGIN
- VERCEL_GIT_COMMIT_AUTHOR_NAME
- VERCEL_GIT_COMMIT_MESSAGE
- VERCEL_GIT_COMMIT_REF
- VERCEL_GIT_COMMIT_SHA
- VERCEL_GIT_PREVIOUS_SHA
- VERCEL_GIT_PROVIDER
- VERCEL_GIT_PULL_REQUEST_ID
- VERCEL_GIT_REPO_ID
- VERCEL_GIT_REPO_OWNER
- VERCEL_GIT_REPO_SLUG
- VERCEL_URL
- VERCEL
- VERCEL_ENV
- VERCEL_GIT_COMMIT_AUTHOR_LOGIN
- VERCEL_GIT_COMMIT_AUTHOR_NAME
- VERCEL_GIT_COMMIT_MESSAGE
- VERCEL_GIT_COMMIT_REF
- VERCEL_GIT_COMMIT_SHA
- VERCEL_GIT_PREVIOUS_SHA
- VERCEL_GIT_PROVIDER
- VERCEL_GIT_PULL_REQUEST_ID
- VERCEL_GIT_REPO_ID
- VERCEL_GIT_REPO_OWNER
- VERCEL_GIT_REPO_SLUG
- VERCEL_URL
maybe the vercel behavior changed here, not sure. in any case, I think I'm unblocked now, thanks!

Did you find this page helpful?