Skip to content

Development instance keys return 400 on Vercel preview deployments after upgrading to @clerk/nextjs 6.38.0 #7893

@chrisanderss0n

Description

@chrisanderss0n

Description

After upgrading @clerk/nextjs from 6.37.2 to 6.38.0 (via Dependabot), Clerk authentication on Vercel preview deployments using development instance keys (pk_test_*) stopped working. The browser console shows:

Clerk: Clerk has been loaded with development keys.
Failed to load resource: the server responded with a status of 400 ()

This was working on 6.37.2 with the same configuration and environment variables. Downgrading back to 6.37.2 resolves the issue.

Steps to reproduce

  1. Create a Next.js app with @clerk/nextjs using development instance keys (pk_test_* / sk_test_*)
  2. Deploy to Vercel with Preview environment using the development keys
  3. Works on @clerk/nextjs@6.37.2
  4. Upgrade to @clerk/nextjs@6.38.0
  5. Visit the Vercel preview URL (e.g. *.vercel.app) — Clerk returns 400

Expected behavior

Development instance keys should work on Vercel preview deployments (*.vercel.app domains), as documented in Set up a preview environment:

"Configure the preview environment to use development API keys from Clerk" with "your host's provided preview domain"

Actual behavior

Clerk returns a 400 error during authentication. The app cannot load the Clerk client.

Environment

  • @clerk/nextjs: 6.38.0 (broken), 6.37.2 (works)
  • next: 16.1.6
  • Deployment: Vercel preview (default *.vercel.app domain)
  • Clerk instance: Development (using pk_test_* keys)

Suspected cause

The 6.38.0 release notes include a fix for "infinite handshake redirect loop when deploying Next.js apps with Clerk development instances to Netlify." This handshake fix may have tightened domain validation in a way that rejects *.vercel.app preview URLs for development instances.

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