Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); feat(astro): Remove createRouteMatcher and support Astro 7 by wobsoriano · Pull Request #8974 · clerk/javascript · GitHub
Skip to content

feat(astro): Remove createRouteMatcher and support Astro 7 - #8974

Merged
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure
Jul 21, 2026
Merged

feat(astro): Remove createRouteMatcher and support Astro 7#8974
wobsoriano merged 16 commits into
mainfrom
rob/user-5610-in-astro-7-return-statement-causes-failure

Conversation

@wobsoriano

@wobsorianowobsoriano commented Jun 23, 2026

Copy link
Copy Markdown
Member

Description

This PR does 3 things:

  • Adds Astro 7 support
  • Removes Astro 4 support
  • Removes createRouteMatcher

Docs with migration instructions is ready https://github.com/clerk/clerk/pull/2988

Fixes#9165

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:

@vercel

vercelBot commented Jun 23, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
clerk-js-sandboxReadyReadyPreview, CommentJul 21, 2026 5:51pm
swingsetReadyReadyPreview, CommentJul 21, 2026 5:51pm

Request Review

@changeset-bot

changeset-botBot commented Jun 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb9fa4

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

This PR includes changesets to release 1 package
NameType
@clerk/astroMajor

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

@coderabbitai

coderabbitaiBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b2fce0f4-5ab6-4fcc-a2a5-7ff5e3b6b179

📥 Commits

Reviewing files that changed from the base of the PR and between 5499148 and 2cb9fa4.

📒 Files selected for processing (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.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) → reviewed against open PR #2988rob/astro-crm-removal instead of the default branch
  • clerk/clerk-docs(manual)
  • clerk/cloudflare-workers(manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts

📝 Walkthrough

Walkthrough

Updates @clerk/astro to support Astro 5, 6, and 7 while dropping Astro 4. Removes the public createRouteMatcher API and documents moving authentication checks into pages and API routes. The Astro integration template removes Tailwind, updates dependencies, and adds resource-level authentication guards. Integration tests are adjusted for Astro routing behavior, a new Astro v6 compatibility build test is added, and machine authentication requests include an Origin header.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Title check✅ PassedThe title clearly states the main changes: removing createRouteMatcher and adding Astro 7 support.
Description check✅ PassedThe description matches the changeset and summarizes the Astro 7 support, Astro 4 removal, and createRouteMatcher removal.
Linked Issues check✅ PassedThe PR updates @clerk/astro to allow Astro 7, which directly satisfies issue #9165.
Out of Scope Changes check✅ PassedThe added test and middleware/page refactors are aligned with the stated Astro 7 and createRouteMatcher removal work.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-newBot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 2cb9fa4

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

dont need tailwind in this...

@github-actions

github-actionsBot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-07-21T17:59:25.885Z

Summary

MetricCount
Packages analyzed19
Packages with changes1
🔴 Breaking changes1
🟡 Non-breaking changes0
🟢 Additions0

Warning
1 breaking change(s) detected - Major version bump required

🤖 This report was reviewed by claude-sonnet-4-6.

🔴 Breaking changes index (1)

Every breaking change, up front. Full diffs are in the package sections below.

PackageSubpathChange
@clerk/astro./servercreateRouteMatcher

@clerk/astro

Current version: 3.4.20
Recommended bump: MAJOR → 4.0.0

Subpath ./server

🔴 Breaking Changes (1)

Changed: createRouteMatcher
- createRouteMatcher: (routes: RouteMatcherParam) => (req: Request) => boolean

Static analyzer: Removed function createRouteMatcher

🤖 AI review (confirmed) (97%): The createRouteMatcher function was entirely removed from the public API, so any consumer importing and calling it will fail to compile.

Migration: Import createRouteMatcher from an alternative entry point such as @clerk/astro/server if it was moved, or replace usages with a manual route-matching implementation.


Report generated by Break Check

Last ran on 2cb9fa4.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

the change basically just removed the early return; in favor of wrapping the menu-item registration logic in the existing else branch

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Astro v6 compatibility smoke test

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
integration/tests/astro/middleware.test.ts (1)

183-186: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid a permanent unconditional skip for this regression case.

test.skip(true, ...) disables this check in every run, so routing/auth regressions here can silently reappear. Prefer a tracked test.fixme (with issue ID) or a version-gated skip so coverage returns automatically when the matcher behavior is fixed.

🤖 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 `@integration/tests/astro/middleware.test.ts` around lines 183 - 186, The
test.skip(true, ...) call unconditionally disables this regression test in every
run, which allows routing and auth regressions to silently reappear. Replace
this with test.fixme(...) that includes a tracked issue ID reference, or
implement version-gated conditional skip logic based on the Astro version so the
test coverage automatically resumes when the routing normalization issue is
resolved. The key is to make the skip temporary and tracked rather than
permanent.
🤖 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 `@integration/tests/astro/middleware.test.ts`:
- Around line 183-186: The test.skip(true, ...) call unconditionally disables
this regression test in every run, which allows routing and auth regressions to
silently reappear. Replace this with test.fixme(...) that includes a tracked
issue ID reference, or implement version-gated conditional skip logic based on
the Astro version so the test coverage automatically resumes when the routing
normalization issue is resolved. The key is to make the skip temporary and
tracked rather than permanent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 1b4b2e9c-0535-4606-8b56-033870a8b624

📥 Commits

Reviewing files that changed from the base of the PR and between fecc5e8 and 2db93cb.

📒 Files selected for processing (4)
  • integration/tests/astro/compatibility.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro
🚧 Files skipped from review as they are similar to previous changes (3)
  • integration/tests/astro/compatibility.test.ts
  • packages/astro/package.json
  • packages/astro/src/astro-components/interactive/UserButton/MenuItemRenderer.astro

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/testUtils/machineAuthHelpers.ts`:
- Around line 275-281: In the POST request handling blocks, the status assertion
must be moved before the JSON parsing. Currently, the code calls
postWithSessionRes.json() before checking postWithSessionRes.status(), which
means if the response is an error, the json() call may fail before the status
assertion runs, obscuring the actual failure. Reorder the statements so that
expect(postWithSessionRes.status()).toBe(200) is called immediately after the
post request completes, before calling await postWithSessionRes.json(). Apply
this same fix to both the postWithSessionRes block and the similar block
referenced in the "Also applies to" comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Repository UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: af4cda56-7137-4065-a8e4-43d80f4d8263

📥 Commits

Reviewing files that changed from the base of the PR and between 2db93cb and a72ad23.

📒 Files selected for processing (1)
  • integration/testUtils/machineAuthHelpers.ts

Comment on lines +275 to 281
const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Assert response status before parsing JSON bodies in POST branches.

json() can throw on non-JSON error responses before the status assertion runs, which obscures the real failure. Assert status first, then parse.

Suggested patch
 const postWithSessionRes = await u.page.request.post(url, {
headers: { Origin: origin },
});
- const sessionData = await postWithSessionRes.json();
expect(postWithSessionRes.status()).toBe(200);
+ const sessionData = await postWithSessionRes.json();
expect(sessionData.userId).toBe(fakeBapiUser.id);
expect(sessionData.tokenType).toBe(TokenType.SessionToken);
const postWithApiKeyRes = await u.page.request.post(url, {
headers: { Authorization: `Bearer ${fakeAPIKey.secret}`, Origin: origin },
});
- const apiKeyData = await postWithApiKeyRes.json();
expect(postWithApiKeyRes.status()).toBe(200);
+ const apiKeyData = await postWithApiKeyRes.json();
expect(apiKeyData.userId).toBe(fakeBapiUser.id);
expect(apiKeyData.tokenType).toBe(TokenType.ApiKey);

Also applies to: 283-285

🤖 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 `@integration/testUtils/machineAuthHelpers.ts` around lines 275 - 281, In the
POST request handling blocks, the status assertion must be moved before the JSON
parsing. Currently, the code calls postWithSessionRes.json() before checking
postWithSessionRes.status(), which means if the response is an error, the json()
call may fail before the status assertion runs, obscuring the actual failure.
Reorder the statements so that expect(postWithSessionRes.status()).toBe(200) is
called immediately after the post request completes, before calling await
postWithSessionRes.json(). Apply this same fix to both the postWithSessionRes
block and the similar block referenced in the "Also applies to" comment.

@wobsoriano

Copy link
Copy Markdown
MemberAuthor

!allow-major

@wobsorianowobsoriano changed the title feat(astro): Support Astro v7feat(astro): Remove createRouteMatcher and support Astro 7Jul 21, 2026

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.
Inline comments:
In `@integration/templates/astro-node/src/pages/discover.astro`:
- Around line 5-9: Add an end-to-end signed-out navigation test in the existing
Astro component test suite for `/discover`, asserting it redirects to the
sign-in route. Reuse the test’s established navigation and redirect assertion
patterns, and ensure the test covers the guard introduced in the `/discover`
page.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 99030421-dd59-4675-b8fc-a285043b53d5

📥 Commits

Reviewing files that changed from the base of the PR and between a72ad23 and 5499148.

📒 Files selected for processing (12)
  • .changeset/floppy-buckets-help.md
  • .changeset/major-astro-remove-route-matcher.md
  • integration/templates/astro-node/src/middleware.ts
  • integration/templates/astro-node/src/pages/api/protected/current-org.ts
  • integration/templates/astro-node/src/pages/api/protected/only-admin.ts
  • integration/templates/astro-node/src/pages/discover.astro
  • integration/templates/astro-node/src/pages/user.astro
  • integration/tests/astro/components.test.ts
  • integration/tests/astro/middleware.test.ts
  • packages/astro/package.json
  • packages/astro/src/server/index.ts
  • packages/astro/src/server/route-matcher.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)
💤 Files with no reviewable changes (2)
  • packages/astro/src/server/route-matcher.ts
  • packages/astro/src/server/index.ts

Comment threadintegration/templates/astro-node/src/pages/discover.astro
@wobsoriano
wobsoriano merged commit 237748d into mainJul 21, 2026
51 checks passed
@wobsoriano
wobsoriano deleted the rob/user-5610-in-astro-7-return-statement-causes-failure branch July 21, 2026 19:14
Sign up for freeto 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.

@clerk/astro should allow new Astro major version as a dependency

4 participants

@wobsoriano@manovotny@alexcarpenter@Ephem