fix(nextjs): remove stray double space in clerkMiddleware detection error - #9408
fix(nextjs): remove stray double space in clerkMiddleware detection error#9408manovotny wants to merge 2 commits into
Conversation
…rror The default auth() case rendered "- clerkMiddleware()..." with two spaces because the prefixSteps ternary fell back to a single space combined with the literal "- " prefix. Fall back to an empty string so the first bullet renders with a single space, matching the docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: eaddce4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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.
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@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: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/nextjs/src/server/errors.ts (1)
27-27: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a regression test for
getAuthAuthHeaderMissing().
createGetAuth()uses this helper withundefined, which is the call path affected by the fallback change. The App Routerauth()path passes[]and does not exercise the fallback.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/nextjs/src/server/errors.ts` at line 27, Add a regression test covering getAuthAuthHeaderMissing() when invoked through createGetAuth() with undefined prefixSteps, verifying the fallback-generated error message. Keep the existing App Router auth() coverage separate, since its [] argument does not exercise this fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/nextjs/src/server/errors.ts`:
- Line 27: Add a regression test covering getAuthAuthHeaderMissing() when
invoked through createGetAuth() with undefined prefixSteps, verifying the
fallback-generated error message. Keep the existing App Router auth() coverage
separate, since its [] argument does not exercise this fallback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: e1be75f3-bece-4c1f-a18b-e68765d43417
📒 Files selected for processing (2)
.changeset/tidy-cameras-jump.mdpackages/nextjs/src/server/errors.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
clerk/clerk_go(manual)clerk/dashboard(manual)clerk/accounts(manual)clerk/backoffice(manual)clerk/clerk(manual)clerk/clerk-docs(manual)clerk/cloudflare-workers(manual)clerk/clerk-ios(auto-detected)clerk/cli(auto-detected)clerk/clerk-android(auto-detected)
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
Description
The
getAuth()"Clerk can't detect usage ofclerkMiddleware()" error emitted a stray double space before its first bullet, so users saw- clerkMiddleware() is used in your Next.js middleware or proxy file.(two spaces after the dash).In
authAuthHeaderMissing, the first bullet'sprefixStepsternary fell back to' '(a single space) whenprefixStepswasundefined— which is thegetAuth()path. It's the only caller that passesundefined;auth()always passes an array (even an empty one, which is truthy), so it never hit this branch. Combined with the literal-already at the start of the line, the fallback produced a double space. This changes it to''so that path renders- clerkMiddleware() is used...with a single space, matching the docs page for this error. TheprefixSteps-provided branch (App Router src-directory hint) is unchanged.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change