feat(nuxt): Add support for keyless mode#7844
Conversation
🦋 Changeset detectedLatest commit: c37d62c The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a keyless quickstart for Nuxt and a changeset declaring a minor release. Introduces Playwright integration tests for Nuxt keyless mode. Adds Nuxt server keyless modules: file storage, lazy-initialized service, utilities, middleware resolution, a ClerkKeylessContext type, and a feature-flag helper. Updates Nuxt plugin to pass keyless context. Simplifies keyless initialization in Astro and React Router packages to a synchronous lazy singleton and removes resetKeylessService. Updates Nuxt template dependency versions. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Introduce Keyless quickstart for Nuxt, enabling use of the Clerk SDK without manual key setup.
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@packages/astro/src/server/keyless/index.ts`:
- Around line 10-14: The keyless() factory unconditionally calls
createFileStorage(), which imports Node-only modules and crashes in edge
runtimes; add a runtime Node check at the start of keyless() (e.g., verify
typeof process !== 'undefined' && process.versions?.node) and if Node is not
available throw a clear error explaining that keyless storage requires a Node
runtime, so createFileStorage() is never invoked in non-Node environments; keep
references to keyless(), keylessServiceInstance, createFileStorage(),
resolveKeysWithKeylessFallback(), and canUseKeyless when making this change.
In `@packages/nuxt/src/runtime/server/keyless/index.ts`:
- Around line 7-39: The current module-level singleton keylessServiceInstance
closes over the first request's event causing stale request context; change to
cache only the storage (e.g., createFileStorage) at module scope and instantiate
createKeylessService per request inside the keyless(event) function so that api
methods call clerkClient(event) with the current H3Event; specifically, keep a
cached storage variable (instead of keylessServiceInstance), and in
keyless(event) call createKeylessService({ storage: cachedStorage, api: {
createAccountlessApplication: async (headers?) => clerkClient(event)...,
completeOnboarding: async (headers?) => clerkClient(event)... }, framework:
'nuxt' }) so no module-level closure captures the first event.
The Nitro build failed because clerkMiddleware.js imports from ../utils/feature-flags and ./keyless/utils, but those directories were not included as tsup entry points, so they were missing from dist/.
Nuxt 4.1.2 has transitive dependency hoisting issues with npm install (used by pkglab), causing all nuxt dev instances to crash with missing packages like @clack/prompts, defu, and @jridgewell/trace-mapping.
These are server-only values matching how Next.js handles them (process.env.CLERK_API_URL, process.env.CLERK_API_VERSION). Now overridable via NUXT_CLERK_API_URL and NUXT_CLERK_API_VERSION.
…_API_URL Keep apiUrl/apiVersion in public runtime config for backwards compat but prefer private config (NUXT_CLERK_API_URL, NUXT_CLERK_API_VERSION) and log a deprecation warning when the public variant is used. This aligns with Next.js which reads CLERK_API_URL from process.env (server-only).
|
!snapshot |
|
!snapshot |
|
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.3.13-snapshot.v20260409161650 --save-exact
npm i @clerk/astro@3.0.13-snapshot.v20260409161650 --save-exact
npm i @clerk/backend@3.2.9-snapshot.v20260409161650 --save-exact
npm i @clerk/chrome-extension@3.1.10-snapshot.v20260409161650 --save-exact
npm i @clerk/clerk-js@6.6.1-snapshot.v20260409161650 --save-exact
npm i @clerk/dev-cli@0.1.1-snapshot.v20260409161650 --save-exact
npm i @clerk/expo@3.1.10-snapshot.v20260409161650 --save-exact
npm i @clerk/expo-passkeys@1.0.11-snapshot.v20260409161650 --save-exact
npm i @clerk/express@2.1.1-snapshot.v20260409161650 --save-exact
npm i @clerk/fastify@3.1.11-snapshot.v20260409161650 --save-exact
npm i @clerk/hono@0.1.11-snapshot.v20260409161650 --save-exact
npm i @clerk/localizations@4.4.1-snapshot.v20260409161650 --save-exact
npm i @clerk/msw@0.0.11-snapshot.v20260409161650 --save-exact
npm i @clerk/nextjs@7.0.13-snapshot.v20260409161650 --save-exact
npm i @clerk/nuxt@2.2.0-snapshot.v20260409161650 --save-exact
npm i @clerk/react@6.2.2-snapshot.v20260409161650 --save-exact
npm i @clerk/react-router@3.0.13-snapshot.v20260409161650 --save-exact
npm i @clerk/shared@4.6.1-snapshot.v20260409161650 --save-exact
npm i @clerk/tanstack-react-start@1.0.13-snapshot.v20260409161650 --save-exact
npm i @clerk/testing@2.0.13-snapshot.v20260409161650 --save-exact
npm i @clerk/ui@1.5.1-snapshot.v20260409161650 --save-exact
npm i @clerk/upgrade@2.0.3-snapshot.v20260409161650 --save-exact
npm i @clerk/vue@2.0.12-snapshot.v20260409161650 --save-exact |
Description
Last SDK to have keyless but not the least 😄
Add keyless mode support to the Nuxt SDK, allowing developers to use Clerk without manually configuring API keys during development.
Also simplifies the keyless service initialization in
@clerk/astroand@clerk/react-routerby replacing the async promise-based pattern with a simpler lazy singleton (consistent with other SDKs like Next.js).Changes
@clerk/nuxt: Add keyless mode (server middleware, plugin, feature flags, file storage)@clerk/nuxt: MoveapiUrl/apiVersionto private runtime config (server-only, matching Next.js)@clerk/astro: Simplify keyless service initialization@clerk/react-router: Simplify keyless service initializationChecklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change