Skip to content

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

Open
djgould wants to merge 3 commits into
dg/keyless-cli/2-prod-errorfrom
dg/keyless-cli/1-remove-bootstrap
Open

feat(nextjs): throw missing-env error instead of keyless bootstrap#9493
djgould wants to merge 3 commits into
dg/keyless-cli/2-prod-errorfrom
dg/keyless-cli/1-remove-bootstrap

Conversation

@djgould

@djgould djgould commented Aug 18, 2026

Copy link
Copy Markdown

Description

In development, when NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY / CLERK_SECRET_KEY are missing, @clerk/nextjs now throws the shared missing-key error (which points to npx clerk@latest init, from #9491) instead of provisioning a keyless application.

  • All bootstrap entry points throw via the shared errorThrower; the error surfaces in both the dev server log and the dev error page
  • keylessMiddleware reduced to baseNextMiddleware, so it's deleted
  • KeylessProvider (kept for the claimed-keys prompt) uses read-only readKeys() instead of getOrCreateKeys() — the SDK never mints applications
  • Configured keys, claimed keys, and production behavior are unchanged

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

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview Aug 19, 2026 10:17pm
swingset Ready Ready Preview Aug 19, 2026 10:17pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5e965b2

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 5e965b2

@djgould

djgould commented Aug 18, 2026

Copy link
Copy Markdown
Author

!snapshot

@github-actions

This comment has been minimized.

@djgould

djgould commented Aug 19, 2026

Copy link
Copy Markdown
Author

!snapshot

@github-actions

Copy link
Copy Markdown
Contributor

Hey @djgould - the snapshot version command generated the following package versions:

Package Version
@clerk/astro 4.0.16-snapshot.v20260819182138
@clerk/backend 3.16.9-snapshot.v20260819182138
@clerk/chrome-extension 3.1.73-snapshot.v20260819182138
@clerk/clerk-js 6.29.3-snapshot.v20260819182138
@clerk/electron 0.0.34-snapshot.v20260819182138
@clerk/electron-passkeys 0.0.4-snapshot.v20260819182138
@clerk/eslint-plugin 0.2.1-snapshot.v20260819182138
@clerk/expo 4.5.1-snapshot.v20260819182138
@clerk/expo-google-signin 1.0.2-snapshot.v20260819182138
@clerk/expo-passkeys 2.0.13-snapshot.v20260819182138
@clerk/express 2.1.60-snapshot.v20260819182138
@clerk/fastify 3.1.70-snapshot.v20260819182138
@clerk/headless 0.0.27-snapshot.v20260819182138
@clerk/hono 0.1.70-snapshot.v20260819182138
@clerk/localizations 4.15.5-snapshot.v20260819182138
@clerk/msw 0.0.63-snapshot.v20260819182138
@clerk/nextjs 7.8.0-snapshot.v20260819182138
@clerk/nuxt 3.0.12-snapshot.v20260819182138
@clerk/react 6.14.5-snapshot.v20260819182138
@clerk/react-router 3.6.14-snapshot.v20260819182138
@clerk/shared 4.29.3-snapshot.v20260819182138
@clerk/swingset 0.0.37-snapshot.v20260819182138
@clerk/tanstack-react-start 1.5.5-snapshot.v20260819182138
@clerk/testing 2.2.27-snapshot.v20260819182138
@clerk/ui 1.30.5-snapshot.v20260819182138
@clerk/upgrade 2.0.6-snapshot.v20260819182138
@clerk/vue 2.4.31-snapshot.v20260819182138

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/astro

npm i @clerk/astro@4.0.16-snapshot.v20260819182138 --save-exact

@clerk/backend

npm i @clerk/backend@3.16.9-snapshot.v20260819182138 --save-exact

@clerk/chrome-extension

npm i @clerk/chrome-extension@3.1.73-snapshot.v20260819182138 --save-exact

@clerk/clerk-js

npm i @clerk/clerk-js@6.29.3-snapshot.v20260819182138 --save-exact

@clerk/electron

npm i @clerk/electron@0.0.34-snapshot.v20260819182138 --save-exact

@clerk/electron-passkeys

npm i @clerk/electron-passkeys@0.0.4-snapshot.v20260819182138 --save-exact

@clerk/eslint-plugin

npm i @clerk/eslint-plugin@0.2.1-snapshot.v20260819182138 --save-exact

@clerk/expo

npm i @clerk/expo@4.5.1-snapshot.v20260819182138 --save-exact

@clerk/expo-google-signin

npm i @clerk/expo-google-signin@1.0.2-snapshot.v20260819182138 --save-exact

@clerk/expo-passkeys

npm i @clerk/expo-passkeys@2.0.13-snapshot.v20260819182138 --save-exact

@clerk/express

npm i @clerk/express@2.1.60-snapshot.v20260819182138 --save-exact

@clerk/fastify

npm i @clerk/fastify@3.1.70-snapshot.v20260819182138 --save-exact

@clerk/headless

npm i @clerk/headless@0.0.27-snapshot.v20260819182138 --save-exact

@clerk/hono

npm i @clerk/hono@0.1.70-snapshot.v20260819182138 --save-exact

@clerk/localizations

npm i @clerk/localizations@4.15.5-snapshot.v20260819182138 --save-exact

@clerk/msw

npm i @clerk/msw@0.0.63-snapshot.v20260819182138 --save-exact

@clerk/nextjs

npm i @clerk/nextjs@7.8.0-snapshot.v20260819182138 --save-exact

@clerk/nuxt

npm i @clerk/nuxt@3.0.12-snapshot.v20260819182138 --save-exact

@clerk/react

npm i @clerk/react@6.14.5-snapshot.v20260819182138 --save-exact

@clerk/react-router

npm i @clerk/react-router@3.6.14-snapshot.v20260819182138 --save-exact

@clerk/shared

npm i @clerk/shared@4.29.3-snapshot.v20260819182138 --save-exact

@clerk/swingset

npm i @clerk/swingset@0.0.37-snapshot.v20260819182138 --save-exact

@clerk/tanstack-react-start

npm i @clerk/tanstack-react-start@1.5.5-snapshot.v20260819182138 --save-exact

@clerk/testing

npm i @clerk/testing@2.2.27-snapshot.v20260819182138 --save-exact

@clerk/ui

npm i @clerk/ui@1.30.5-snapshot.v20260819182138 --save-exact

@clerk/upgrade

npm i @clerk/upgrade@2.0.6-snapshot.v20260819182138 --save-exact

@clerk/vue

npm i @clerk/vue@2.4.31-snapshot.v20260819182138 --save-exact

djgould and others added 3 commits August 19, 2026 15:15
Squashed from the original four commits of this PR (bootstrap removal, import
sort, adversarial-review findings, non-interactive CLI wording) during the
simple-first stack reorder.

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

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-08-19T22:23:13.476Z

Summary

Metric Count
Packages analyzed 19
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on 5e965b2.

@@ -0,0 +1,5 @@
---
'@clerk/nextjs': minor

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with minor but i'd appreciate someone else's input

'@clerk/backend': patch
---

Mark the internal `createBootstrapSignedOutState` as deprecated. It is no longer used by `@clerk/nextjs` and is kept only for older published SDK versions.

@djgould djgould Aug 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tempted to just remove this change and deprecate seperately

@brkalow brkalow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djgould can we remove more of the keyless code paths or do we need to retain them for some reason?

We can do this in a follow up!

const { rest, runningWithClaimedKeys, __internal_scriptsSlot, children } = props;

// NOTE: Create or read keys on every render. Usually this means only on hard refresh or hard navigations.
// Read-only: the SDK no longer mints keyless applications, it only reads claimed keys from disk.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the KeylessProvider?

@@ -52,6 +53,9 @@ export async function ClerkProvider<TUi extends Ui = Ui>(
) : undefined;

if (shouldRunAsKeyless) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove more of the keyless code paths here?

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.

2 participants