Skip to content

Commit 0929f2f

Browse files
authored
fix(upgrade): Add missing Core 3 upgrade guide entries (#7888)
1 parent 37a4cbb commit 0929f2f

8 files changed

Lines changed: 171 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/upgrade": patch
3+
---
4+
5+
Add missing Core 3 upgrade guide entries for breaking changes: `getToken` SSR behavior, React Router middleware requirement, Expo `publishableKey` requirement, Astro `as` prop removal, `simple` theme export change, React Router `api.server` removal, and Next.js minimum version bump.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: '`as` prop removed from Astro button components'
3+
packages: ['astro']
4+
matcher: '<Sign(In|Up|Out)Button[\s\S]*?\bas\b'
5+
matcherFlags: 'm'
6+
category: 'deprecation-removal'
7+
---
8+
9+
The deprecated `as` prop has been removed from unstyled button components in `@clerk/astro`. Use the `asChild` prop with a custom element in the default slot instead.
10+
11+
Affected components: `SignInButton`, `SignUpButton`, `SignOutButton`, `CheckoutButton`, `PlanDetailsButton`, `SubscriptionDetailsButton`.
12+
13+
```diff
14+
- <SignInButton as="a" href="/sign-in">
15+
- Sign in
16+
- </SignInButton>
17+
+ <SignInButton asChild>
18+
+ <a href="/sign-in">Sign in</a>
19+
+ </SignInButton>
20+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: '`publishableKey` prop required in Expo `ClerkProvider`'
3+
packages: ['expo']
4+
matcher: '<ClerkProvider'
5+
category: 'breaking'
6+
warning: true
7+
---
8+
9+
The `publishableKey` prop is now required in `ClerkProvider` for Expo apps. Previously, it would fall back to the `EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY` or `CLERK_PUBLISHABLE_KEY` environment variables, but environment variables inside `node_modules` are not inlined during production builds in React Native/Expo, which could cause apps to crash in production.
10+
11+
```diff
12+
+ const publishableKey = process.env.EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY!;
13+
14+
- <ClerkProvider>
15+
+ <ClerkProvider publishableKey={publishableKey}>
16+
{/* Your app */}
17+
</ClerkProvider>
18+
```
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: '`useAuth().getToken` is no longer `undefined` during SSR'
3+
matcher: 'getToken'
4+
category: 'breaking'
5+
---
6+
7+
`useAuth().getToken` is no longer `undefined` during server-side rendering. It is now a function that throws a `clerk_runtime_not_browser` error when called on the server.
8+
9+
If you were checking `getToken === undefined` to avoid calling it during SSR, update your code to catch the error instead:
10+
11+
```diff
12+
- if (getToken) {
13+
- const token = await getToken();
14+
- }
15+
+ try {
16+
+ const token = await getToken();
17+
+ } catch (error) {
18+
+ if (isClerkRuntimeError(error) && error.code === 'clerk_runtime_not_browser') {
19+
+ // Handle server-side scenario
20+
+ }
21+
+ }
22+
```
23+
24+
### Who is affected
25+
26+
- If you only use `getToken` in `useEffect`, event handlers, or with non-suspenseful data fetching libraries, **no change is necessary** as these only run on the client.
27+
- If you were using `getToken === undefined` checks to avoid calling it during SSR, update to use try-catch error handling.
28+
29+
### Server-side auth
30+
31+
To access auth data server-side, use the [`Auth` object](https://clerk.com/docs/reference/backend/types/auth-object) provided by your SDK instead of `useAuth()`.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: 'Minimum Next.js version increased to 15.2.3'
3+
packages: ['nextjs']
4+
matcher: "next\":\\s*\"(?:\\^|~|>|=|\\s)*(?:13|14)\\."
5+
matcherFlags: 'm'
6+
category: 'version'
7+
---
8+
9+
Support for Next.js 13 and 14 has been dropped. `@clerk/nextjs` now requires `next@>=15.2.3`.
10+
11+
```diff
12+
{
13+
"dependencies": {
14+
- "next": "^14.0.0",
15+
+ "next": "^15.2.3",
16+
}
17+
}
18+
```
19+
20+
See the [Next.js upgrade guide](https://nextjs.org/docs/app/building-your-application/upgrading) for help migrating your application.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: '`@clerk/react-router/api.server` export removed'
3+
packages: ['react-router']
4+
matcher: '@clerk/react-router/api.server'
5+
category: 'breaking'
6+
---
7+
8+
The `@clerk/react-router/api.server` export has been removed. Use `@clerk/react-router/server` instead.
9+
10+
```diff
11+
- import { getAuth } from '@clerk/react-router/api.server';
12+
+ import { getAuth } from '@clerk/react-router/server';
13+
```
14+
15+
A codemod is available to automatically apply this change:
16+
17+
```bash
18+
npx @clerk/upgrade --release core-3
19+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: '`rootAuthLoader` requires `clerkMiddleware()` in React Router'
3+
packages: ['react-router']
4+
matcher: 'rootAuthLoader'
5+
category: 'breaking'
6+
---
7+
8+
`rootAuthLoader` now requires `clerkMiddleware()` to be installed. Using `rootAuthLoader` without middleware will throw a runtime error.
9+
10+
### Before (Core 2)
11+
12+
```tsx
13+
import { rootAuthLoader } from '@clerk/react-router/ssr.server';
14+
15+
export const loader = (args: Route.LoaderArgs) => rootAuthLoader(args);
16+
```
17+
18+
### After (Core 3)
19+
20+
1. Enable the `v8_middleware` future flag:
21+
22+
```ts
23+
// react-router.config.ts
24+
export default {
25+
future: {
26+
v8_middleware: true,
27+
},
28+
} satisfies Config;
29+
```
30+
31+
2. Use `clerkMiddleware()` alongside `rootAuthLoader`:
32+
33+
```tsx
34+
import { clerkMiddleware, rootAuthLoader } from '@clerk/react-router/server';
35+
36+
export const middleware: Route.MiddlewareFunction[] = [clerkMiddleware()];
37+
38+
export const loader = (args: Route.LoaderArgs) => rootAuthLoader(args);
39+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: '`simple` theme export removed from `@clerk/ui`'
3+
matcher:
4+
- 'import.*simple.*from.*@clerk/ui'
5+
- '__experimental_simple'
6+
- 'experimental__simple'
7+
category: 'breaking'
8+
---
9+
10+
The `simple` theme is no longer exported directly from `@clerk/ui`. Use the `appearance` prop to apply it instead:
11+
12+
```diff
13+
- import { __experimental_simple } from '@clerk/ui';
14+
-
15+
- <ClerkProvider appearance={{ baseTheme: __experimental_simple }}>
16+
+ <ClerkProvider appearance={{ theme: 'simple' }}>
17+
{/* Your app */}
18+
</ClerkProvider>
19+
```

0 commit comments

Comments
 (0)