Skip to content

feat(nextjs): throw missing-env error instead of keyless bootstrap - #9474

Closed
djgould wants to merge 4 commits into
mainfrom
dg/keyless-cli-init-error
Closed

feat(nextjs): throw missing-env error instead of keyless bootstrap#9474
djgould wants to merge 4 commits into
mainfrom
dg/keyless-cli-init-error

Conversation

@djgould

@djgould djgould commented Aug 17, 2026

Copy link
Copy Markdown

Description

Experiment: promote the CLI keyless flow over SDK keyless mode.

In development, when NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY / CLERK_SECRET_KEY are missing, @clerk/nextjs no longer provisions a keyless application. All three bootstrap entry points (app-router server ClerkProvider, clerkMiddleware, createOrReadKeylessAction) now throw:

Clerk: Missing environment variables (NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY).

To set up Clerk for this project, run:

  npx clerk@latest init

The error surfaces in both the dev server log and the dev error page. Configured keys, claimed keys, and production behavior are unchanged.

To test: run an app-router app with no Clerk env vars and hit any route.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other: experiment / RFC

🤖 Generated with Claude Code

djgould and others added 2 commits August 17, 2026 16:02
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a4ff714

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@clerk/backend Patch
@clerk/nextjs Minor
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swingset Ready Ready Preview Aug 18, 2026 5:06pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
clerk-js-sandbox Skipped Skipped Aug 18, 2026 5:06pm

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@9474

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@9474

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@9474

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@9474

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9474

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9474

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9474

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@9474

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9474

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@9474

@clerk/express

npm i https://pkg.pr.new/@clerk/express@9474

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@9474

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9474

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@9474

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@9474

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@9474

@clerk/react

npm i https://pkg.pr.new/@clerk/react@9474

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@9474

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@9474

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@9474

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@9474

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@9474

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@9474

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@9474

commit: a4ff714

Stop honoring keyless cookie credentials, delete orphaned keyless sync
machinery, throw from the client provider path, drop the machine-token
carve-out, add unit tests for the throw sites, and rewrite the keyless
integration tests for the new contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… error

Sandbox agent trials showed agents assume `npx clerk@latest init` requires
a login and route around it, or invent placeholder keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@djgould

djgould commented Aug 18, 2026

Copy link
Copy Markdown
Author

Superseded by #9484 — restacked fresh off main as part 1 of the keyless→CLI stack (#9484#9485#9486).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant