Skip to content

Unable to run npx convex codegen on Vercel without CONVEX_DEPLOY_KEY #81

@Loskir

Description

@Loskir

As far as I understand, npx convex codegen is supposed to generate local files without pushing it to the server. I do not have any problem running it locally even though I don't have any server credentials in my env.

But on Vercel there's a check that throws an error if deploy key is not present:

async function checkIfBuildEnvironmentRequiresDeploymentConfig(ctx: Context) {
const buildEnvironment = getBuildEnvironment();
if (buildEnvironment) {
return await ctx.crash({
exitCode: 1,
errorType: "fatal",
printedMessage:
`${buildEnvironment} build environment detected but no Convex deployment configuration found.\n` +
`Set one of:\n` +
` • ${CONVEX_DEPLOY_KEY_ENV_VAR_NAME} for Convex Cloud deployments\n` +
` • ${CONVEX_SELF_HOSTED_URL_VAR_NAME} and ${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME} for self-hosted deployments\n` +
`See https://docs.convex.dev/production/hosting or https://docs.convex.dev/self-hosting`,
});
}
}

export function getBuildEnvironment(): string | false {
return process.env.VERCEL
? "Vercel"
: process.env.NETLIFY
? "Netlify"
: false;
}

There seems to be no way to suppress this check. Again, I believe that I don't need this key set for my purpose. I'm only trying to run a codegen for the frontend, not to release the backend

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions