@clerk/upgrade 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/guide-generators/core-2/backend/__output.mdx +687 -0
- package/dist/guide-generators/core-2/chrome-extension/__output.mdx +530 -0
- package/dist/guide-generators/core-2/expo/__output.mdx +546 -0
- package/dist/guide-generators/core-2/fastify/__output.mdx +448 -0
- package/dist/guide-generators/core-2/gatsby/__output.mdx +503 -0
- package/dist/guide-generators/core-2/js/__output.mdx +628 -0
- package/dist/guide-generators/core-2/nextjs/__output.mdx +1169 -0
- package/dist/guide-generators/core-2/node/__output.mdx +592 -0
- package/dist/guide-generators/core-2/overview/__output.mdx +33 -0
- package/dist/guide-generators/core-2/overview/intro.mdx +1 -1
- package/dist/guide-generators/core-2/react/__output.mdx +790 -0
- package/dist/guide-generators/core-2/remix/__output.mdx +432 -0
- package/dist/guide-generators/core-2/retheme/__output.mdx +440 -0
- package/dist/guide-generators/core-2/shared/prepare.mdx +0 -5
- package/dist/guide-generators/core-2/shared/update-version.mdx +5 -5
- package/dist/versions/core-2/backend/members-count.md +2 -2
- package/dist/versions/core-2/index.js +1 -1
- package/dist/versions/core-2/nextjs/auth-middleware-deprecated.md +2 -2
- package/dist/versions/core-2/nextjs/authmiddleware-import-change.md +1 -1
- package/dist/versions/core-2/nextjs/with-clerk-middleware-removed.md +1 -1
- package/dist/versions/core-2/node/createclerkexpressrequireauth-public-key-required.md +2 -2
- package/dist/versions/core-2/node/createclerkexpresswithauth-publickey-required.md +7 -0
- package/package.json +1 -1
- /package/dist/versions/core-2/{js/supported-external-accounts-type-removed.md → common/supported-external-accounts-removed.md} +0 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Upgrading Remix to Core 2"
|
|
3
|
+
description: "Learn how to upgrade from the Clerk Remix SDK to the latest version."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{/* WARNING: This is a generated file and should not be edited directly. To update its contents, see the "upgrade" package in the clerk/javascript repo. */}
|
|
7
|
+
|
|
8
|
+
# Upgrading `@clerk/remix` to Core 2
|
|
9
|
+
|
|
10
|
+
Core 2 is included in the Remix SDK starting with version 4. This new version ships with an improved design and UX for its built-in components, no "flash of white page" when authenticating, no more need to add a custom error boundary, and a variety of smaller DX improvements and housekeeping items. Each of the potentially breaking changes are detailed in this guide, below.
|
|
11
|
+
|
|
12
|
+
By the end of this guide, you’ll have successfully upgraded your Remix project to use `@clerk/remix` v4. You’ll learn how to update your dependencies, resolve breaking changes, and find deprecations. Step-by-step instructions will lead you through the process.
|
|
13
|
+
|
|
14
|
+
## Preparing to upgrade
|
|
15
|
+
|
|
16
|
+
Before uprading, it's highly recommended that you update your Clerk SDKs to the latest Core 1 version (`npm i @clerk/remix@3`). Some changes required for Core 2 SDKs can be applied incrementally to the v4 release, which should contribute to a smoother upgrading experience. After updating, look out for deprecation messages in your terminal and browser console. By resolving these deprecations you'll be able to skip many breaking changes from Core 2.
|
|
17
|
+
|
|
18
|
+
Additionally, some of the minumum version requirements for some base dependencies have been updated such that versions that are no longer supported or are at end-of-life are no longer guaranteed to work correctly with Clerk.
|
|
19
|
+
|
|
20
|
+
**Updating Node.js**
|
|
21
|
+
|
|
22
|
+
You need to have Node.js `18.17.0` or later installed. Last year, Node.js 16 entered EOL (End of life) status, so support for this version has been removed across Clerk SDKs. You can check your Node.js version by running `node -v` in your terminal. Learn more about how to [update and install Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).
|
|
23
|
+
|
|
24
|
+
**Updating React**
|
|
25
|
+
|
|
26
|
+
All react-dependent Clerk SDKs now require you to use React 18 or higher. You can update your project by installing the latest version of `react` and `react-dom`.
|
|
27
|
+
|
|
28
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
29
|
+
```bash filename="terminal"
|
|
30
|
+
npm install react@latest react-dom@latest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash filename="terminal"
|
|
34
|
+
yarn add react@latest react-dom@latest
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash filename="terminal"
|
|
38
|
+
pnpm add react@latest react-dom@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</CodeBlockTabs>
|
|
42
|
+
|
|
43
|
+
If you are upgrading from React 17 or lower, make sure to [learn about how to upgrade your React version to 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) as well.
|
|
44
|
+
|
|
45
|
+
## Updating to Core 2
|
|
46
|
+
|
|
47
|
+
Whenever you feel ready, go ahead and install the latest version of any Clerk SDKs you are using. Make sure that you are prepared to patch some breaking changes before your app will work properly, however. The commands below demonstrate how to install the latest version.
|
|
48
|
+
|
|
49
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
50
|
+
```bash filename="terminal"
|
|
51
|
+
npm install @clerk/remix
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash filename="terminal"
|
|
55
|
+
yarn add @clerk/remix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```bash filename="terminal"
|
|
59
|
+
pnpm add @clerk/remix
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
</CodeBlockTabs>
|
|
63
|
+
|
|
64
|
+
## CLI upgrade helper
|
|
65
|
+
|
|
66
|
+
Clerk now provides a `@clerk/upgrade` CLI tool that you can use to ease the upgrade process. The tool will scan your codebase and produce a list of changes you'll need to apply to your project. It should catch the vast majority of the changes needed for a successful upgrade to any SDK including Core 2. This can save you a lot of time reading through changes that don't apply to your project.
|
|
67
|
+
|
|
68
|
+
To run the CLI tool, navigate to your project and run it in the terminal:
|
|
69
|
+
|
|
70
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
71
|
+
```bash filename="terminal"
|
|
72
|
+
npx @clerk/upgrade
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash filename="terminal"
|
|
76
|
+
yarn dlx @clerk/upgrade
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```bash filename="terminal"
|
|
80
|
+
pnpm dlx @clerk/upgrade
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</CodeBlockTabs>
|
|
84
|
+
|
|
85
|
+
If you are having trouble with `npx`, it's also possible to install directly with `npm i @clerk/upgrade -g`, and can then be run with the `clerk-upgrade` command.
|
|
86
|
+
|
|
87
|
+
## Breaking Changes
|
|
88
|
+
|
|
89
|
+
### `ClerkErrorBoundary` removed
|
|
90
|
+
|
|
91
|
+
`ClerkErrorBoundary` is no longer needed for correct error handling in remix, so we have removed this function from the remix SDK, and it can be removed from your code as well. Example below:
|
|
92
|
+
|
|
93
|
+
```diff
|
|
94
|
+
import { rootAuthLoader } from '@clerk/remix/ssr.server';
|
|
95
|
+
import {
|
|
96
|
+
ClerkApp,
|
|
97
|
+
- ClerkErrorBoundary
|
|
98
|
+
} from '@clerk/remix';
|
|
99
|
+
|
|
100
|
+
export const loader = (args: DataFunctionArgs) => {
|
|
101
|
+
return rootAuthLoader(args);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export default ClerkApp(App);
|
|
105
|
+
|
|
106
|
+
- export const ErrorBoundary = ClerkErrorBoundary();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Component design adjustments
|
|
110
|
+
|
|
111
|
+
The new version ships with improved design and UX across all of Clerk's [UI components](/docs/components/overview). If you have used the [`appearance` prop](/docs/components/customization/overview) or tokens for a [custom theme](/docs/components/customization/overview#create-a-custom-theme), you will likely need to make some adjustments to ensure your styling is still looking great. If you're using the [localization prop](/docs/components/customization/localization) you will likely need to make adjustments to account for added or removed localization keys.
|
|
112
|
+
|
|
113
|
+
[More detail on these changes »](component-redesign)
|
|
114
|
+
|
|
115
|
+
### After sign up/in/out default value change
|
|
116
|
+
|
|
117
|
+
Defining redirect URLs for after sign up, in, and/or out via the Clerk dashboard has been removed in Core 2. In your Clerk dashboard, under "paths", there is a section called "Component paths", where URLs could be defined that had a deprecation warning. In Core 2, this functionality has been removed, and specifying redirect paths via the dashboard will no longer work. If you need to pass a redirect URL for after sign in/up/out, there are [a few different ways this can be done](https://clerk.com/docs/account-portal/custom-redirects), from environment variables to middleware to supplying them directly to the relevant components.
|
|
118
|
+
|
|
119
|
+
As part of this change, the default URL for each of these props has been set to `/`, so if you are passing `/` explicitly to any one of the above props, that line is no longer necessary and can be removed.
|
|
120
|
+
|
|
121
|
+
```diff
|
|
122
|
+
- <UserButton afterSignOutUrl='/' />
|
|
123
|
+
+ <UserButton />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `afterSignXUrl` changes
|
|
127
|
+
|
|
128
|
+
Some changes are being made to the way that "after sign up/in url"s and redirect url props are handled as part of this new version, in order to make behavior more clear and predictable.
|
|
129
|
+
|
|
130
|
+
> We will refer to these urls as `afterSignXUrl` where `X` could be `Up` or `In` depending on the context.
|
|
131
|
+
|
|
132
|
+
Previously, setting `afterSignInUrl` or `afterSignOutUrl` would only actually redirect some of the time. If the user clicks on any form of link that takes them to a sign up/in page, Clerk automatically sets `redirect_url` in the querystring such that after the sign up or in, the user is returned back to the page they were on before. This is a common pattern for sign up/in flows, as it leads to the least interruption of the user's navigation through your app. When a `redirect_url` is present, any value passed to `afterSignInUrl` or `afterSignUpUrl` is ignored. However, if the user navigates directly to a sign up/in page, there’s no redirect url in the querystring and in this case the `afterSignInUrl` or `afterSignOutUrl` would take effect. This behavior was not intuitive and didn't give a way to force a redirect after sign up/in, so the behavior is changing to address both of these issues.
|
|
133
|
+
|
|
134
|
+
All `afterSignXUrl` props and `CLERK_AFTER_SIGN_X_URL` environment variables have been removed, and should be replaced by one of the following options:
|
|
135
|
+
|
|
136
|
+
- `signXForceRedirectUrl` / `CLERK_SIGN_X_FORCE_REDIRECT_URL` - if set, Clerk will always redirect to provided URL, regardless of what page the user was on before. Use this option with caution, as it will interrupt the user’s flow by taking them away from the page they were on before.
|
|
137
|
+
- `signXFallbackRedirectUrl` / `CLERK_SIGN_UP_FALLBACK_REDIRECT_URL` - if set, this will mirror the previous behavior, only redirecting to the provided URL if there is no `redirect_url` in the querystring.
|
|
138
|
+
|
|
139
|
+
If neither value is set, Clerk will redirect to the `redirect_url` if present, otherwise it will redirect to `/`. If you'd like to retain the current behavior of your app without any changes, you can switch `afterSignXUrl` with `signXFallbackRedirectUrl` as such:
|
|
140
|
+
|
|
141
|
+
```diff
|
|
142
|
+
- <SignIn afterSignInUrl='/foo' />
|
|
143
|
+
+ <SignIn signInFallbackRedirectUrl='/foo' />
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Removed: `orgs` claim on JWT
|
|
147
|
+
|
|
148
|
+
In the previous version of Clerk's SDKs, if you decode the session token that Clerk returns from the server, you'll currently find an `orgs` claim on it. It lists all the orgs associated with the given user. Now, Clerk returns the `org_id`, `org_slug`, and `org_role` of the **active** organization.
|
|
149
|
+
|
|
150
|
+
The `orgs` claim was part of the `JwtPayload`. Here are a few examples of where the `JwtPayload` could be found.
|
|
151
|
+
|
|
152
|
+
<Accordion titles={["Next.js", "Fastify", "@clerk/backend", "@clerk/clerk-sdk-node"]} heading="h5">
|
|
153
|
+
<AccordionPanel>
|
|
154
|
+
```typescript filename="Next.js"
|
|
155
|
+
import { getAuth } from "@clerk/nextjs/server"
|
|
156
|
+
const claims: JwtPayload = getAuth(request).sessionClaims
|
|
157
|
+
|
|
158
|
+
import { getAuth } from "@clerk/ssr.server"
|
|
159
|
+
const claims: JwtPayload = (await getAuth(request)).sessionClaims
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
</AccordionPanel>
|
|
163
|
+
<AccordionPanel>
|
|
164
|
+
```typescript filename="Fastify"
|
|
165
|
+
import { getAuth } from "@clerk/fastify"
|
|
166
|
+
const claims: JwtPayload = (await getAuth(request)).sessionClaims
|
|
167
|
+
```
|
|
168
|
+
</AccordionPanel>
|
|
169
|
+
<AccordionPanel>
|
|
170
|
+
```typescript filename="@clerk/backend"
|
|
171
|
+
import { createClerkClient } from "@clerk/backend"
|
|
172
|
+
|
|
173
|
+
const clerkClient = createClerkClient({ secretKey: "" })
|
|
174
|
+
const requestState = await clerkClient.authenticateRequest(
|
|
175
|
+
request,
|
|
176
|
+
{ publishableKey: "" }
|
|
177
|
+
)
|
|
178
|
+
const claims: JwtPayload = requestState.toAuth().sessionClaims
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
</AccordionPanel>
|
|
182
|
+
<AccordionPanel>
|
|
183
|
+
```typescript filename="@clerk/clerk-sdk-node"
|
|
184
|
+
import { clerkClient } from "@clerk/clerk-sdk-node"
|
|
185
|
+
|
|
186
|
+
router.use((...args) => clerkClient.expressRequireAuth()(...args))
|
|
187
|
+
router.get("/me", async (req, reply: Response) => {
|
|
188
|
+
return reply.json({ auth: req.auth })
|
|
189
|
+
})
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</AccordionPanel>
|
|
193
|
+
</Accordion>
|
|
194
|
+
|
|
195
|
+
If you would like to have your JWT return all of the user's organizations, you can create a [custom JWT template](/docs/backend-requests/making/jwt-templates) in your dashboard. Add `{ "orgs": "user.organizations" }` to it.
|
|
196
|
+
|
|
197
|
+
### Path routing is now the default
|
|
198
|
+
|
|
199
|
+
On components like [`<SignIn />`](/docs/components/authentication/sign-in) you can define the props `routing` and `path`. `routing` can be set to `'hash' | 'path' | 'virtual'` and describes the routing strategy that should be used. `path` defines where the component is mounted when `routing="path"` is used.
|
|
200
|
+
|
|
201
|
+
In the latest version, the **default** `routing` strategy has become `'path'`. Unless you change the `routing` prop, you'll need to define the `path` prop. The affected components are:
|
|
202
|
+
|
|
203
|
+
- `<SignIn />`
|
|
204
|
+
- `<SignUp />`
|
|
205
|
+
- `<UserProfile />`
|
|
206
|
+
- `<CreateOrganization />`
|
|
207
|
+
- `<OrganizationProfile />`
|
|
208
|
+
|
|
209
|
+
Here's how you'd use the components going forward:
|
|
210
|
+
|
|
211
|
+
```jsx
|
|
212
|
+
<SignIn path="/sign-in" />
|
|
213
|
+
<SignUp path="/sign-up" />
|
|
214
|
+
<UserProfile path="/user-profile" />
|
|
215
|
+
<CreateOrganization path="/create-org" />
|
|
216
|
+
<OrganizationProfile path="/org-profile" />
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If you don't define the `path` prop an error will be thrown. Of course, you can still use `routing="hash"` or `routing="virtual"`.
|
|
220
|
+
|
|
221
|
+
```jsx
|
|
222
|
+
<UserProfile routing="hash" />
|
|
223
|
+
<OrganizationProfile routing="virtual" />
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
For the @clerk/remix SDK, you can set environment variables for the sign up/in URLs and avoid needing to explicitly pass the path to the `<SignIn />` and `<SignUp />` components.
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
```env filename=".env"
|
|
233
|
+
CLERK_SIGN_IN_URL=/sign-in
|
|
234
|
+
CLERK_SIGN_UP_URL=/sign-up
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
If you have defined both environment variables, you're able to use the `<SignIn />` and `<SignUp />` components without any props, as such:
|
|
240
|
+
|
|
241
|
+
```jsx
|
|
242
|
+
<SignIn />
|
|
243
|
+
<SignUp />
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### Image URL Name Consolidation
|
|
249
|
+
|
|
250
|
+
There are a number of Clerk primitives that contain images, and previously they each had different property names, like `avatarUrl`, `logoUrl`, `profileImageUrl`, etc. In order to promote consistency and make it simpler for developers to know where to find associated images, all image properties are now named `imageUrl`. See the list below for all affected classes:
|
|
251
|
+
|
|
252
|
+
<Accordion titles={["<code>Organization.logoUrl</code> -> <code>Organization.imageUrl</code>", "<code>User.profileImageUrl</code> -> <code>.imageUrl</code>", "<code>ExternalAccount.avatarUrl</code> -> <code>.imageUrl</code>", "<code>OrganizationMembershipPublicUserData.profileImageUrl</code> -> <code>.imageUrl</code>"]}>
|
|
253
|
+
<AccordionPanel>
|
|
254
|
+
The `logoUrl` property of any [`Organization` object](https://clerk.com/docs/references/javascript/organization/organization#organization) has been changed to `imageUrl`.
|
|
255
|
+
</AccordionPanel>
|
|
256
|
+
<AccordionPanel>
|
|
257
|
+
The `profileImageUrl` property of any `User` object has been changed to `imageUrl`.
|
|
258
|
+
</AccordionPanel>
|
|
259
|
+
<AccordionPanel>
|
|
260
|
+
The `avatarUrl` property of any [`ExternalAcccount` object](https://clerk.com/docs/references/javascript/external-account) has been changed to `imageUrl`.
|
|
261
|
+
</AccordionPanel>
|
|
262
|
+
<AccordionPanel>
|
|
263
|
+
The `profileImageUrl` property of any `OrganizationMembershipPublicUserData` object has been changed to `imageUrl`.
|
|
264
|
+
</AccordionPanel>
|
|
265
|
+
</Accordion>
|
|
266
|
+
|
|
267
|
+
### Deprecation removals & housekeeping
|
|
268
|
+
|
|
269
|
+
As part of this major version, a number of previously deprecated props, arugments, methods, etc. have been removed. Additionally there have been some changes to things that are only used internally, or only used very rarely. It's highly unlikely that any given app will encounter any of these items, but they are all breaking changes, so they have all been documented below.
|
|
270
|
+
|
|
271
|
+
<Callout type='info'>
|
|
272
|
+
For this section more than any other one, please use the CLI upgrade tool (`npx @clerk/upgrade`). Changes in this
|
|
273
|
+
section are very unlikely to appear in your codebase, the tool will save time looking for them.
|
|
274
|
+
</Callout>
|
|
275
|
+
|
|
276
|
+
#### Deprecation removals
|
|
277
|
+
|
|
278
|
+
<Accordion titles={["<code>User.update({ password: 'x' })</code> -> <code>User.updatePassword('x')</code>", "<code>apiKey</code> -> <code>secretKey</code> as argument to createClerkClient", "<code>apiKey</code> -> <code>secretKey</code> as argument to rootAuthLoader", "<code>apiKey</code> -> <code>secretKey</code> as argument to getAuth", "<code>frontendApi</code> -> <code>publishableKey</code> as prop to <code>ClerkProvider</code>", "<code>frontendApi</code> -> <code>publishableKey</code> as argument to rootAuthLoader", "<code>CLERK_FRONTEND_API</code> replaced by <code>CLERK_PUBLISHABLE_KEY</code>", "<code>CLERK_API_KEY</code> replaced by <code>CLERK_SECRET_KEY</code>", "<code>Clerk</code> -> <code>{ createClerkClient }</code>"]}>
|
|
279
|
+
<AccordionPanel>
|
|
280
|
+
If you are updating a user's password via the [`User.update` method](https://clerk.com/docs/references/javascript/user/user#update), it must be changed to [`User.updatePassword`](https://clerk.com/docs/references/javascript/user/password-management#update-password) instead. This method will require the current password as well as the desired new password. We made this update to improve the security of password changes. Example below:
|
|
281
|
+
|
|
282
|
+
```diff
|
|
283
|
+
- user.update({ password: 'foo' });
|
|
284
|
+
|
|
285
|
+
+ user.updatePassword({
|
|
286
|
+
+ currentPassword: 'bar',
|
|
287
|
+
+ newPassword: 'foo',
|
|
288
|
+
+ signOutOfOtherSessions: true,
|
|
289
|
+
+ });
|
|
290
|
+
```
|
|
291
|
+
</AccordionPanel>
|
|
292
|
+
<AccordionPanel>
|
|
293
|
+
The `apiKey` argument passed to `createClerkClient` must be changed to `secretKey`.
|
|
294
|
+
|
|
295
|
+
```diff
|
|
296
|
+
import { createClerkClient } from '@clerk/remix/api.server';
|
|
297
|
+
|
|
298
|
+
- createClerkClient({ apiKey: '...' });
|
|
299
|
+
+ createClerkClient({ secretKey: '...' });
|
|
300
|
+
```
|
|
301
|
+
</AccordionPanel>
|
|
302
|
+
<AccordionPanel>
|
|
303
|
+
The `apiKey` argument passed to `rootAuthLoader` must be changed to `secretKey`.
|
|
304
|
+
|
|
305
|
+
```diff
|
|
306
|
+
import { rootAuthLoader } from '@clerk/remix/ssr.server';
|
|
307
|
+
|
|
308
|
+
- export const loader = args => rootAuthLoader(args, { apiKey: '...' });
|
|
309
|
+
+ export const loader = args => rootAuthLoader(args, { secretKey: '...' });
|
|
310
|
+
```
|
|
311
|
+
</AccordionPanel>
|
|
312
|
+
<AccordionPanel>
|
|
313
|
+
The `apiKey` argument passed to `getAuth` must be changed to `secretKey`.
|
|
314
|
+
|
|
315
|
+
```diff
|
|
316
|
+
import { getAuth } from '@clerk/remix/ssr.server';
|
|
317
|
+
|
|
318
|
+
export const loader: LoaderFunction = async args => {
|
|
319
|
+
- return getAuth(args, { apiKey: '...' });
|
|
320
|
+
+ return getAuth(args, { secretKey: '...' });
|
|
321
|
+
};
|
|
322
|
+
```
|
|
323
|
+
</AccordionPanel>
|
|
324
|
+
<AccordionPanel>
|
|
325
|
+
The `frontendApi` prop passed to `<ClerkProvider>` was renamed to `publishableKey`. **Note:** The values are different, so this is not just a key replacement. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). [More information](/docs/deployments/overview#api-keys-and-environment-variables).
|
|
326
|
+
</AccordionPanel>
|
|
327
|
+
<AccordionPanel>
|
|
328
|
+
The `frontendApi` argument passed to `rootAuthLoader` must be changed to `publishableKey`.
|
|
329
|
+
|
|
330
|
+
```diff
|
|
331
|
+
import { rootAuthLoader } from '@clerk/remix/ssr.server';
|
|
332
|
+
|
|
333
|
+
- export const loader = args => rootAuthLoader(args, { frontendApi: '...' });
|
|
334
|
+
+ export const loader = args => rootAuthLoader(args, { publishableKey: '...' });
|
|
335
|
+
```
|
|
336
|
+
</AccordionPanel>
|
|
337
|
+
<AccordionPanel>
|
|
338
|
+
The `CLERK_FRONTEND_API` environment variable was renamed to `CLERK_PUBLISHABLE_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production). **Note:** The values are different, so this is not just a key replacement. [More information](/docs/deployments/overview#api-keys-and-environment-variables).
|
|
339
|
+
</AccordionPanel>
|
|
340
|
+
<AccordionPanel>
|
|
341
|
+
The `CLERK_API_KEY` environment variable was renamed to `CLERK_SECRET_KEY`. You can visit your [Clerk dashboard](https://dashboard.clerk.com/last-active?path=api-keys) to copy/paste the new keys after choosing your framework. Make sure to update this in all environments (e.g. dev, staging, production).
|
|
342
|
+
</AccordionPanel>
|
|
343
|
+
<AccordionPanel>
|
|
344
|
+
The `Clerk` default import has changed to `createClerkClient` and been moved to a named import rather than default. You must update your import path in order for it to work correctly. Example below of the fix that needs to be made:
|
|
345
|
+
|
|
346
|
+
```diff
|
|
347
|
+
- import Clerk from "@clerk/remix"
|
|
348
|
+
+ import { createClerkClient } from "@clerk/remix"
|
|
349
|
+
```
|
|
350
|
+
</AccordionPanel>
|
|
351
|
+
</Accordion>
|
|
352
|
+
|
|
353
|
+
#### Other Breaking changes
|
|
354
|
+
|
|
355
|
+
<Accordion titles={["<code>setSession</code> -> <code>setActive</code>", "<code>Organization.create('x')</code> -> <code>Organization.create({ name: 'x' })</code>", "<code>Organization.getPendingInvitations()</code> -> <code>Organization.getInvitations({ status: 'pending' })</code>", "<code>isMagicLinkError</code> -> <code>isEmailLinkError</code>", "<code>MagicLinkErrorCode</code> -> <code>EmailLinkErrorCode</code>", "<code>useMagicLink</code> -> <code>useEmailLink</code>", "Replace <code>signOutCallback</code> prop on <code>SignOutButton</code> with <code>redirectUrl</code>"]}>
|
|
356
|
+
<AccordionPanel>
|
|
357
|
+
`setSession` should be replaced with `setActive`. The format of the parameters has changed slightly - `setActive` takes an object where `setSession` took params directly. The `setActive` function also can accept an `organization` param that is used to set the currently active organization. The return signature did not change. Read the [API documentation](/docs/references/javascript/clerk/session-methods#set-active) for more detail. This function should be expected to be returned from one of the following Clerk hooks: `useSessionList`, `useSignUp`, or `useSignIn`. Some migration examples:
|
|
358
|
+
|
|
359
|
+
```diff
|
|
360
|
+
- await setSession('sessionID', () => void)
|
|
361
|
+
+ await setActive({ session: 'sessionID', beforeEmit: () => void })
|
|
362
|
+
|
|
363
|
+
- await setSession(sessionObj)
|
|
364
|
+
+ await setActive({ session: sessionObj })
|
|
365
|
+
|
|
366
|
+
- await setSession(sessionObj, () => void)
|
|
367
|
+
+ await setActive({ session: sessionObj, beforeEmit: () => void })
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
`setActive` also supports setting an active organization:
|
|
371
|
+
|
|
372
|
+
```js
|
|
373
|
+
await setActive({
|
|
374
|
+
session: 'sessionID',
|
|
375
|
+
organization: 'orgID',
|
|
376
|
+
beforeEmit: () => void
|
|
377
|
+
})
|
|
378
|
+
|
|
379
|
+
await setActive({
|
|
380
|
+
session: sessionObj,
|
|
381
|
+
organization: orgObj,
|
|
382
|
+
beforeEmit: () => void
|
|
383
|
+
})
|
|
384
|
+
```
|
|
385
|
+
</AccordionPanel>
|
|
386
|
+
<AccordionPanel>
|
|
387
|
+
Passing a string as an argument to `Organization.create` is no longer possible - instead, pass an object with the `name` property.
|
|
388
|
+
|
|
389
|
+
```diff
|
|
390
|
+
- Organization.create('...');
|
|
391
|
+
+ Organization.create({ name: '...' });
|
|
392
|
+
```
|
|
393
|
+
</AccordionPanel>
|
|
394
|
+
<AccordionPanel>
|
|
395
|
+
The `Organization.getPendingInvitations()` method has been removed. You can use `Organization.getInvitations` instead.
|
|
396
|
+
|
|
397
|
+
```diff
|
|
398
|
+
- Organization.getPendingInvitations();
|
|
399
|
+
+ Organization.getInvitations({ status: 'pending' });
|
|
400
|
+
```
|
|
401
|
+
</AccordionPanel>
|
|
402
|
+
<AccordionPanel>
|
|
403
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
|
|
404
|
+
</AccordionPanel>
|
|
405
|
+
<AccordionPanel>
|
|
406
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
|
|
407
|
+
</AccordionPanel>
|
|
408
|
+
<AccordionPanel>
|
|
409
|
+
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects functionality.
|
|
410
|
+
</AccordionPanel>
|
|
411
|
+
<AccordionPanel>
|
|
412
|
+
The `signOutCallback` prop on the [`<SignOutButton />` component](https://clerk.com/docs/components/unstyled/sign-out-button) has been removed. Instead, you can use the `redirectUrl` prop. Example below:
|
|
413
|
+
|
|
414
|
+
```diff
|
|
415
|
+
import { SignOutButton } from "@clerk/clerk-react";
|
|
416
|
+
|
|
417
|
+
export const Signout = () => {
|
|
418
|
+
return (
|
|
419
|
+
<SignOutButton
|
|
420
|
+
- signOutCallback={() => { window.location.href = "/your-path" }}
|
|
421
|
+
+ redirectUrl="/your-path"
|
|
422
|
+
>
|
|
423
|
+
<button>Sign Out</button>
|
|
424
|
+
</SignOutButton>
|
|
425
|
+
)
|
|
426
|
+
}
|
|
427
|
+
```
|
|
428
|
+
</AccordionPanel>
|
|
429
|
+
</Accordion>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|