Skip to content

Commit 018d950

Browse files
ci(repo): Version packages (#9206)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 5070797 commit 018d950

8 files changed

Lines changed: 54 additions & 57 deletions

File tree

.changeset/floppy-buckets-help.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/major-astro-remove-route-matcher.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

.changeset/swift-plums-cover.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/typedoc-multi-example-double-comma.md

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/astro/CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
# @clerk/astro
22

3+
## 4.0.0
4+
5+
### Major Changes
6+
7+
- Add support for Astro 7 and drop support for Astro 4. If you are still on Astro 4, follow the [Astro upgrade guide](https://docs.astro.build/en/guides/upgrade-to/v6/) to upgrade your project before updating `@clerk/astro`. ([#8974](https://github.com/clerk/javascript/pull/8974)) by [@wobsoriano](https://github.com/wobsoriano)
8+
9+
- Remove `createRouteMatcher` from `@clerk/astro/server`. Use resource-based auth checks instead: move auth checks into each Astro page, API route, or server-side handler that accesses protected data. Middleware-based auth checks rely on path matching, which can diverge from how Astro routes requests and leave protected resources reachable. ([#8974](https://github.com/clerk/javascript/pull/8974)) by [@wobsoriano](https://github.com/wobsoriano)
10+
11+
```ts
12+
import type { APIRoute } from 'astro';
13+
14+
export const GET: APIRoute = ({ locals }) => {
15+
const { userId } = locals.auth();
16+
17+
if (!userId) {
18+
return new Response('Unauthorized', { status: 401 });
19+
}
20+
21+
return Response.json({ userId });
22+
};
23+
```
24+
25+
If you want to hand this work to a coding agent, use this migration prompt:
26+
27+
```md
28+
Migrate my Astro project away from Clerk's removed `createRouteMatcher` API.
29+
30+
1. Open `src/middleware.ts` (or `src/middleware.js`) and find every matcher created
31+
with `createRouteMatcher` from `@clerk/astro/server`, along with the middleware
32+
logic that uses it (returning 401s, calling `auth().redirectToSignIn()`, etc.).
33+
2. For every route those matchers protected, move the auth check into the resource itself:
34+
- In `.astro` pages, add this to the frontmatter:
35+
const { userId, redirectToSignIn } = Astro.locals.auth();
36+
if (!userId) return redirectToSignIn();
37+
- In API routes and server handlers, add this at the top of the handler:
38+
const { userId } = locals.auth();
39+
if (!userId) return new Response('Unauthorized', { status: 401 });
40+
- Keep any role or permission checks (`auth().has(...)`) with the resource as well.
41+
3. Remove the `createRouteMatcher` import and calls from the middleware. Keep
42+
`clerkMiddleware()` itself. Middleware logic unrelated to auth protection
43+
(locale redirects, headers, etc.) may stay, using plain `URL`/pathname checks.
44+
4. Make sure every page and endpoint previously covered by a matcher pattern
45+
(including glob patterns like `/dashboard(.*)`) now has its own check, then
46+
verify the project builds.
47+
```
48+
349
## 3.4.20
450

551
### Patch Changes

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/astro",
3-
"version": "3.4.20",
3+
"version": "4.0.0",
44
"description": "Clerk SDK for Astro",
55
"keywords": [
66
"auth",

packages/nextjs/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## 7.5.22
4+
5+
### Patch Changes
6+
7+
- Remove the redundant `https://*.client.protect.clerk.com` source from CSP headers generated by `clerkMiddleware()`. ([#9207](https://github.com/clerk/javascript/pull/9207)) by [@mwickett](https://github.com/mwickett)
8+
39
## 7.5.21
410

511
### Patch Changes

packages/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/nextjs",
3-
"version": "7.5.21",
3+
"version": "7.5.22",
44
"description": "Clerk SDK for NextJS",
55
"keywords": [
66
"clerk",

0 commit comments

Comments
 (0)