Skip to content

Vercel template deployment fails - CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY missing from environment variable form #618

@jonathanagustin

Description

@jonathanagustin

Describe the bug

When using the official Next Forge Vercel deployment template, the build fails with missing CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY environment variables. These variables are not even included as configurable fields in the Vercel deployment form, making it impossible to provide them during the deployment setup process.

next-forge version

I am using version latest (commit 5823f94)

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://vercel.com/templates/Next.js/next-forge
  2. Click Deploy to start the deployment process
  3. Configure target user/organization and repository, then click Create
  4. Notice that CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY are not present in the environment variable form
  5. Fill in all the available environment variables
  6. Click Deploy
  7. Build fails with environment variable validation errors for the missing Clerk variables

Expected behavior

The Vercel template should include CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY as configurable environment variable fields in the deployment form, or the auth package should handle missing Clerk credentials gracefully.

Screenshots

Vercel deployment form missing Clerk environment variable fields

Build error during turbo build:

❌ Invalid environment variables: [
  {
    code: 'invalid_type',
    expected: 'string',
    received: 'undefined',
    path: [ 'CLERK_SECRET_KEY' ],
    message: 'Required'
  },
  {
    code: 'invalid_type',
    expected: 'string',
    received: 'undefined',
    path: [ 'NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY' ],
    message: 'Required'
  }
]

Desktop:

  • OS: Linux
  • Browser: Chrome

Additional Context

This is an issue with the Vercel template configuration. The template URL is missing required environment variables from its configuration, making one-click deployment impossible.

Root cause:

The Vercel template URL needs to include CLERK_SECRET_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY in its env parameter list.

Fix:

Update the template URL to include these variables:

&env=...existing vars...,CLERK_SECRET_KEY,NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions