Upgrading from v4 to v5
Clerk's SDKs include React, Next.js, Remix, Expo, Redwood, and others. This guide helps you with uprading to the next major version of your SDK.
Version 5 ships with an improved design and UX for its built-in components, no "flash of white page" when authenticating, and a new middleware for Next.js which defaults to not protecting any routes. Along with these highly requested features some smaller DX improvements and housekeeping items made its way into the release. If you want to know everything that's new, read the v5 announcement post.
Version 5/v5 refers to the @clerk/clerk-js
package version. However, other SDKs like @clerk/backend
or @clerk/clerk-expo
are versioned independently (and would upgrade from v1 to v2). To make this page easier to read for instances of general advice only v5 is mentioned. You can think of v4 as the previous major of your SDK and v5 as the current in those cases.
If you're curious about Clerk's approach to versioning and support, head to the long term support document. Version 5 includes potentially breaking changes, as well as the removal of previously deprecated features.
For most users we expect a smooth upgrade path as only a couple of changes will be required: Update dependencies, run the @clerk/upgrade
CLI, update Clerk, and handle any breaking changes.
If you're using Next.js, you can read a more streamlined Upgrading Next.js from v4 to v5 guide.
Handle deprecations
Before uprading, Clerk highly recommends updating your packages to the latest v4 version. Some changes required for v5 can be applied incrementally to the latest v4, 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 some breaking changes for v5.
As of this major version Clerk also provides a @clerk/upgrade
CLI you can use to ease the upgrade. A questionnaire will ask you a couple of questions and afterwards you'll get a list of changes you'll need to apply to your project. Navigate to your project and run it in the terminal:
terminalnpx @clerk/upgrade
terminalyarn dlx @clerk/upgrade
terminalpnpm dlx @clerk/upgrade
Update dependencies
This section explains breaking changes for peer dependencies and tooling. In order to successfully upgrade, you need to resolve these changes. Clerk's SDKs enforce these requirements through setting peerDependencies
and engines
keys in their package.json
.
Update Node.js
All SDKs that rely on Node.js require you to have Node.js 18.17.0 or later installed. Last year Node.js 16 entered EOL (End of life) status so it's time to bump the required version for Clerk, too. Learn how to update and install Node.js.
Update React
All SDKs that rely on React require you to use React 18. You can update your project by installing the latest version of react
and react-dom
.
terminalnpm install react@latest react-dom@latest
terminalyarn add react@latest react-dom@latest
terminalpnpm add react@latest react-dom@latest
Update Next.js
If you're using @clerk/nextjs
you will need to update your Next.js project to 13.0.4 or later. Check out Next's upgrade guides:
Update Clerk
Update each Clerk dependency to the latest version using your package manager. Below you can find some snippets for popular SDKs.
terminalnpm install @clerk/nextjs@latest
terminalyarn add @clerk/nextjs@latest
terminalpnpm add @clerk/nextjs@latest
terminalnpm install @clerk/clerk-react@latest
terminalyarn add @clerk/clerk-react@latest
terminalpnpm add @clerk/clerk-react@latest
terminalnpm install @clerk/remix@latest
terminalyarn add @clerk/remix@latest
terminalpnpm add @clerk/remix@latest
terminalnpm install @clerk/clerk-js@latest
terminalyarn add @clerk/clerk-js@latest
terminalpnpm add @clerk/clerk-js@latest
terminalnpm install @clerk/clerk-sdk-node@latest
terminalyarn add @clerk/clerk-sdk-node@latest
terminalpnpm add @clerk/clerk-sdk-node@latest
Breaking Changes
This section explains breaking changes that were made across SDKs or only in individual ones. In order to successfully upgrade, you need to resolve these changes. All documentation is updated to refer to only the current, supported code.
@clerk/nextjs
As this package uses @clerk/clerk-react
under the hood, you potentially have to take its Clerk v5 changes into account, too. @clerk/nextjs
re-exports functions and components from @clerk/clerk-react
.
You can read a more streamlined guide at Upgrading Next.js from v4 to v5.
A couple of subpath imports have been removed, but functionality remains the same.
In recent versions Next.js enforced the convention that public environment variables should be prefixed with NEXT_PUBLIC_
. This also applies to Clerk's environment variables. Please apply these changes:
A couple of exported constants have been removed from @clerk/nextjs
as you should use your defined environment variables instead.
@clerk/clerk-react
The @clerk/clerk-react
package is used by all SDKs based on React and as such any change in this package can potentially affect those packages, too. SDKs based on React re-export certain components and functions from @clerk/clerk-react
. Please check your code for the changes below, even if you didn't explicitly install it.
Routing
Please take extra care in reading the instructions for the new routing behavior.
On components like <SignIn />
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.
With Clerk v5 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:
<SignIn />
<SignUp />
<UserProfile />
<CreateOrganization />
<OrganizationProfile />
Here's how you'd use the components going forward:
<SignIn path="/sign-in" /> <SignUp path="/sign-up" /> <UserProfile path="/user-profile" /> <CreateOrganization path="/create-org" /> <OrganizationProfile path="/org-profile" />
If you don't define the path
prop an error will be thrown. Of course, you can still use routing="hash"
or routing="virtual"
.
<UserProfile routing="hash" /> <OrganizationProfile routing="virtual" />
However, there are two exceptions to this behavior. If you're using @clerk/nextjs
or @clerk/remix
, you can set environment variables for <SignIn />
and <SignUp />
.
.env.localNEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
.envCLERK_SIGN_IN_URL=/sign-in CLERK_SIGN_UP_URL=/sign-up
Only if you're using one of these two frameworks and defined both environment variables, you're able to use the <SignIn />
and <SignUp />
components without any props.
// Only works for Next.js / Remix when environment variables are set <SignIn /> <SignUp />
Replace navigate
with routerPush
& routerReplace
The navigate
prop on <ClerkProvider>
allowed developers to override the default navigation behavior with a custom function. However, navigate
was only able to push, not replace routes. The router is now able to do both, and as such, the props for <ClerkProvider>
were updated. The routerPush
and routerReplace
props replace the old navigate
prop.
For more information on what push and replace mean in relation to the browser history api, check out the "Working with the History API" docs.
If you’d like to keep the same behavior as you had with the single navigate
prop, pass the exact same function to both routerPush
and routerReplace
. For example:
- <ClerkProvider navigate={x => x} /> + <ClerkProvider routerPush={x => x} routerReplace={x => x} />
Removal of higher order functions & components
The withUser
, withSession
, and withClerk
higher order functions (HOF) have been removed. The WithUser
, WithSession
, and WithClerk
higher order components (HOC) have been removed. Clerk recommends using React hooks going forward.
If you would still like to use these functions and components, you can reimplement them on your own.
Other @clerk/clerk-react
changes
-
The
MultisessionAppSupport
export has moved from@clerk/clerk-react
to@clerk/clerk-react/internal
-
The following exports have moved from
@clerk/clerk-react
to@clerk/clerk-react/errors
:isClerkAPIResponseError
,isEmailLinkError
,isKnownError
,isMetamaskError
,MagicLinkErrorCode
, andisMagicLinkError
-
The
MembershipRole
type was replaced withOrganizationCustomRoleKey
(related to roles and permissions). This TypeScript type can be found in such use cases:import { useAuth } from "@clerk/clerk-react" const { orgRole } = useAuth()
To support the existing roles
admin
,basic_member
, andguest_member
apply interface merging using the following snippet:interface ClerkAuthorization { permission: '' role: 'admin' | 'basic_member' | 'guest_member' }
-
Replace
signOutCallback
prop on the<SignOutButton />
withredirectUrl
. This aligns the API surface with other UI components provided by@clerk/clerk-react
.import { SignOutButton } from "@clerk/clerk-react"; export const Signout = () => { return ( <SignOutButton - signOutCallback={() => { window.location.href = "/your-path" }} + redirectUrl="/your-path" > <button>Sign Out</button> </SignOutButton> ) }
-
Further changes to types:
redirectToUserProfile
now returnsPromise<unknown>
instead ofvoid
redirectToOrganizationProfile
now returnsPromise<unknown>
instead ofvoid
redirectToCreateOrganization
now returnsPromise<unknown>
instead ofvoid
-
The default values of
afterSignOutUrl
,afterSignInUrl
, andafterSignUpUrl
have been changed to/
. The URLs defined in your Dashboard > Account Portal > Redirects won't affect these anymore. Read the Customizing your Account Portal redirects to learn how to override these defaults.
@clerk/remix
As this package uses @clerk/clerk-react
under the hood you potentially have to take its changes into account, too. This package re-exports functions and components from @clerk/clerk-react
.
The ClerkErrorBoundary
helper has been removed as it's no longer needed.
import { rootAuthLoader } from "@clerk/remix/ssr.server" - import { ClerkApp, ClerkErrorBoundary } from "@clerk/remix" + import { ClerkApp } from "@clerk/remix" export const loader = (args: DataFunctionArgs) => { return rootAuthLoader(args); } export default ClerkApp(App) - export const ErrorBoundary = ClerkErrorBoundary()
If you used the default Clerk
import, you'll need to use a named createClerkClient
import.
- import Clerk from "@clerk/remix" + import { createClerkClient } from "@clerk/remix"
@clerk/backend
If you're using an SDK based on React like @clerk/nextjs
or @clerk/remix
most changes are already handled for you.
-
The top level
Clerk
import was moved from a default export to a namedcreateClerkClient
export. It's a name change and functionality stayed the same.- import Clerk from "@clerk/backend" + import { createClerkClient } from "@clerk/backend"
-
You need to pass a
Request
to the first argument of theauthenticateRequest()
method.- const state = await clerkClient.authenticateRequest({ + const state = await clerkClient.authenticateRequest(req, { secretKey: "", publishableKey: "", - origin: req.headers.get("origin"), - host: req.headers.get("host"), - // ...etc })
-
The
createEmail()
method (and as such theemails
API endpoint) has been removed. For the time being no alternative method will be provided for creating and sending emails directly from Clerk's JavaScript SDKs. If you're currently relying on this functionality and wish to update, please reach out to Clerk's support. -
The following exports have been moved from
@clerk/backend
to@clerk/backend/jwt
:verifyJwt
,decodeJwt
, andsignJwt
-
The following exports have been moved from
@clerk/backend
to@clerk/backend/internal
:constants
,redirect
,createAuthenticateRequest
, andcreateIsomorphicRequest
-
The following exports have been moved from
@clerk/backend
to@clerk/backend/errors
:SignJWTError
,TokenVerificationError
,TokenVerificationErrorAction
,TokenVerificationErrorCode
, andTokenVerificationErrorReason
@clerk/clerk-js
If you're using an SDK based on React like @clerk/nextjs
or @clerk/clerk-react
most changes are already handled for you.
Pagination response & parameters
Please take extra care in reading the instructions for the modified shape of paginated responses and new pagination parameters.
For every method that returns a paginated list the ClerkPaginatedResponse
has changed from [Item]
to { totalCount: number; data: [Item] }
.
The affected methods are:
Organization.getRoles()
Organization.getDomains()
Organization.getMembershipRequests()
Organization.getMemberships()
Organization.getInvitations()
Organization.getOrganizationList()
Organization.getOrganizationInvitationList()
User.getOrganizationInvitations()
User.getOrganizationSuggestions()
User.getOrganizationMemberships()
User.getOrganizationMembershipList()
Here's a before/after example:
import Clerk from "@clerk/clerk-js" const clerk = new Clerk() await clerk.load() - const orgs = await clerk.user.getOrganizationMemberships() + const { data: orgs } = await clerk.user.getOrganizationMemberships()
The pagination parameters on some methods have changed from { limit: number; offset: number }
to { initialPage: number; pageSize: number }
.
The affected methods are:
Organization.getRoles()
Organization.getDomains()
Organization.getMembershipRequests()
Organization.getMemberships()
Organization.getInvitations()
User.getOrganizationInvitations()
User.getOrganizationSuggestions()
User.getOrganizationMemberships()
Here's a before/after example:
import Clerk from "@clerk/clerk-js" const clerk = new Clerk() await clerk.load() const { data: orgs } = await clerk.user.getOrganizationMemberships({ - limit: 10, + pageSize: 10, - offset: 10, + initialPage: 2, })
Other @clerk/clerk-js
changes
-
The
User.update()
method no longer acceptspassword
as a parameter. If you'd like to update a users's password, please useUser.updatePassword()
instead.- User.update({ password: "new" }) + User.updatePassword({ newPassword: "new" })
-
The default values of
afterSignOutUrl
,afterSignInUrl
, andafterSignUpUrl
have been changed to/
. The URLs defined in your Dashboard > Account Portal > Redirects won't affect these anymore. Read the Customizing your Account Portal redirects to learn how to override these defaults. -
The
Clerk.redirectToHome()
method has been removed. You can useClerk.redirectToAfterSignUp()
orClerk.redirectToAfterSignIn()
instead. -
The
navigate
option ofClerk.load()
was removed. It allowed developers to override the default navigation behavior with a custom function. However,navigate
was only able to push, not replace routes. The router is now able to do both, and as such,routerPush
androuterReplace
replace the oldnavigate
function.- Clerk.load({ navigate: x => x }) + Clerk.load({ routerPush: x => x, routerReplace: x => x })
Some more niche use cases and their changes:
Other packages
@clerk/chrome-extension
As this package uses @clerk/clerk-react
under the hood you potentially have to take its changes into account, too. This package re-exports functions and components from @clerk/clerk-react
. In most cases you probably only need to check if the change in default routing behavior affects you.
-
The
tokenCache
prop on<ClerkProvider>
was renamed tostorageCache
.- <ClerkProvider tokenCache={}> + <ClerkProvider storageCache={}>
The
storageCache
interface has been expanded to allow more flexibility:type StorageCache = { createKey: (...keys: string[]) => string; get: <T = any>(key: string) => Promise<T>; remove: (key: string) => Promise<void>; set: (key: string, value: string) => Promise<void>; }
@clerk/clerk-expo
As this package uses @clerk/clerk-react
under the hood you potentially have to take its changes into account, too. This package re-exports functions and components from @clerk/clerk-react
. In most cases you probably only need to check if the change in default routing behavior affects you.
@clerk/localizations
If you're using Clerk's localization feature to provide your own localizations, you will need to update your data as the underlying structure has changed. If you're just using one of Clerk's default localizations (e.g. through import { frFR } from "@clerk/localizations"
) you need to install the latest version of @clerk/localizations
.
The en-US localization object has changed in three ways: New keys, deleted keys, and changed values.
@clerk/clerk-sdk-node
-
Use
createClerkClient
and pass options to it instead of using these removed setters:setClerkApiVersion
,setClerkHttpOptions
,setClerkServerApiUrl
, andsetClerkApiKey
.- import { clerkClient, setClerkApiKey } from "@clerk/clerk-sdk-node" + import { createClerkClient } from "@clerk/clerk-sdk-node" - setClerkApiKey("") + const clerkClient = createClerkClient({ secretKey: "" }) await clerkClient.users.getUser(userId)
-
The
request.auth
object type has changed fromLegacyAuthObject
toAuthObject
-
If you used the default
Clerk
import, you'll need to use a namedcreateClerkClient
import.- import Clerk from "@clerk/clerk-sdk-node" + import { createClerkClient } from "@clerk/clerk-sdk-node"
@clerk/fastify
If you used the default Clerk
import, you'll need to use a named createClerkClient
import.
- import Clerk from "@clerk/fastify" + import { createClerkClient } from "@clerk/fastify"
Common
This section explains changes that were made across multiple packages. Depending on which package you use you'll need to change these common changes in multiple places.
API_URL
value has changed
The API_URL
export has changed from https://api.clerk.dev
to https://api.clerk.com
. Subsequently the default value for the CLERK_API_URL
environment variable has also changed.
Component appearance
As mentioned in the v5 announcement post Clerk's prebuilt components got a new look and UX. These changes may impact your style customization applied through the appearance
prop or tokens for a custom theme. Below you'll learn about the biggest changes and what to look out for.
You didn't customize Clerk's components and want to use the new design? Great! Then you don't need to do anything and can completely skip the instructions below.
New styling defaults
Note: If you want your components to appear exactly as the Clerk team designed them you can skip this section.
The default values of some appearance variables have changed which may impact your UI (if you are not already overriding them).
- The default
colorPrimary
value changed from#103FEF
to#2F3037
. As the new color is a dark grey, thecolorPrimary
of the dark theme was changed to#FFFFFF
. - The default
fontSize
value changed from1rem
to0.8125rem
- The default
fontWeight
values changed from{ normal: 400, medium: 500, bold: 600 }
to{ normal: 400, medium: 500, bold: 700 }
- Previously, the default value for
fontSmoothing
wasauto
. This value is now unset. If you want to pass a custom value to it, you can still do so.
Changes to elements
Note: If you're not using the elements
appearance property you can skip this section.
You're able to pass additional classes to Clerk component elements by using the elements
property on appearance
. Some keys have changed or have been completely removed. Clerk recommends using IntelliSense in your IDE to inspect the type of appearance.elements
.
Here are some more details on individual component changes.
Localization
Note: If you're not using the localization prop you can skip this section.
The @clerk/localizations
package and the underlying structure has changed. Read the dedicated localization upgrade guide to learn more.
Pagination changes in @clerk/clerk-js
The pagination response & parameters changes inside @clerk/clerk-js
can also potentially affect you if you use SDKs like @clerk/clerk-react
, @clerk/nextjs
, or @clerk/remix
. Double check if you're using any of the mentioned methods in your application.
Deprecated
The following deprecated features are no longer supported and documented. Please update your project as these deprecations will be dropped in v6.
authMiddleware
The authMiddleware
API from @clerk/nextjs
has been marked as deprecated. We highly recommend using clerkMiddleware
going forward. clerkMiddleware
protects no routes by default and you need to add your individual routes you want to opt into protection. Here's an example of having all routes public except for everything under /dashboard
.
middleware.tsimport { authMiddleware } from "@clerk/nextjs" export default authMiddleware({ publicRoutes: (req) => !req.url.includes("/dashboard"), }) export const config = { matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], }
middleware.tsimport { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server" const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]) export default clerkMiddleware((auth, request) => { if (isProtectedRoute(request)) { auth().protect() } }) export const config = { matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], }
You can also read the How to migrate section of the Next.js upgrade guide for more examples.
Previously deprecated features
The following deprecated features have been entirely removed from any SDK and can no longer be used. It's recommended to first handle any deprecations before trying the upgrade. In order to successfully upgrade, you need to resolve these changes and there will no longer be any supporting documentation for these old features.
Use the @clerk/upgrade
CLI to more quickly find these previously deprecated features.
terminalnpx @clerk/upgrade
terminalyarn dlx @clerk/upgrade
terminalpnpm dlx @clerk/upgrade
Renamed: apiKey
The CLERK_API_KEY
environment variable was renamed to CLERK_SECRET_KEY
. Make sure to update this in all environments (e.g. dev, staging, production).
The apiKey
parameter was renamed to secretKey
. You are using this with createClerkClient
for example.
You can visit your Clerk dashboard to copy/paste the new keys after choosing your framework.
Removed: frontendApi
The CLERK_FRONTEND_API
environment variable was removed. Use CLERK_PUBLISHABLE_KEY
on your frontend instead. Make sure to update this in all environments (e.g. dev, staging, production).
The frontendApi
prop passed to <ClerkProvider>
was removed and you should use publishableKey
. The function parameter was also renamed (you are using this with createClerkClient
for example).
The values are different, so this is not just a key replacement. You can visit your Clerk dashboard to copy/paste the new keys after choosing your framework.
Renamed: Magic link
Across Clerk's documentation and codebases the term "magic link" was changed to "email link" as it more accurately reflects the functionality.
Inside your code, change the following values:
handleMagicLinkVerification
=>handleEmailLinkVerification
isMagicLinkError
=>isEmailLinkError
MagicLinkError
=>EmailLinkError
MagicLinkErrorCode
=>EmailLinkErrorCode
useMagicLink
=>useEmailLink
createMagicLinkFlow()
=>createEmailLinkFlow()
Functionality stayed the same and only the name changed.
Removed: setSession
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 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:
import { useSignIn } from "@clerk/clerk-react" export default function SignIn() { const { setActive } = useSignIn() - await setSession("sessionID", () => void) + await setActive({ session: "sessionID", beforeEmit: () => void }) - await setSession(sessionObj) + await setActive({ session: sessionObj }) - await setSession(sessionObj, () => void) + await setActive({ session: sessionObj, beforeEmit: () => void }) }
setActive
also supports setting an active organization:
await setActive({ session: "sessionID", organization: "orgID", beforeEmit: () => void }) await setActive({ session: sessionObj, organization: orgObj, beforeEmit: () => void })
Or as part of the Clerk
class of @clerk/clerk-js
:
import Clerk from "@clerk/clerk-js" const clerkPublishableKey = ​your_publishable_key​ const clerk = new Clerk(clerkPublishableKey) await clerk.load() await clerk.setActive({ session: "" })
Removed: orgs
claim on JWT
In v4 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. In v5 Clerk returns the org_id
, org_slug
, and org_role
of the active organization.
The orgs
claim was part of the JwtPayload
. Here are a few examples of where the JwtPayload
could be found.
If you would like to have your JWT return all of the user's organizations, you can create a custom JWT template in your dashboard. Add { "orgs": "user.organizations" }
to it.
@clerk/nextjs
withClerkMiddleware
has been removed. Use clerkMiddleware
instead. Here's an example of having all routes public except for everything under /dashboard
.
middleware.tsimport { withClerkMiddleware } from "@clerk/nextjs/server" import { getAuth } from "@clerk/nextjs/server" import { NextResponse } from "next/server" import type { NextRequest } from "next/server" const publicPaths = ["/", "/sign-in*", "/sign-up*"] const isPublic = (path: string) => { return publicPaths.find((x) => path.match(new RegExp(`^${x}$`.replace("*$", "($|/)"))) ) } export default withClerkMiddleware((request: NextRequest) => { if (isPublic(request.nextUrl.pathname)) { return NextResponse.next(); } const { userId } = getAuth(request) if (!userId) { const signInUrl = new URL("/sign-in", request.url) return NextResponse.redirect(signInUrl) } return NextResponse.next() }) export const config = { matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], }
middleware.tsimport { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server" import { NextResponse } from "next/server" const isProtectedRoute = createRouteMatcher(["/dashboard(.*)"]) export default clerkMiddleware((auth, request) => { if (isProtectedRoute(request)) { auth().protect() } return NextResponse.next() }) export const config = { matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], }
@clerk/clerk-react
-
The
useOrganizations
hook was removed. UseuseOrganizationList
instead. Please note that the latter has different function signatures. -
The
userProfile
prop on theUserButton
component has been changed touserProfileProps
. This is purely a name change, none of the values need to be updated. -
The
afterSwitchOrganizationUrl
prop on the<OrganizationSwitcher />
component has been renamed toafterSelectOrganizationUrl
.- <OrganizationSwitcher afterSwitchOrganizationUrl="" /> + <OrganizationSwitcher afterSelectOrganizationUrl="" />
-
The
invitationList
andmembershipList
parameter for theuseOrganization
hook was renamed toinvitations
andmemberships
. In v4 you'd pass inlimit
andoffset
, now you have to useinitialPage
andpageSize
.Before:
const { invitationList, membershipList } = useOrganization({ invitationList: { limit: 10, offset: 1 }, membershipList: { limit: 10, offset: 1 }, })
After:
const { invitations, memberships } = useOrganization({ invitations: { initialPage: 1, pageSize: 10 }, memberships: { initialPage: 1, pageSize: 10 }, })
For more information, read the
useOrganization
docs.
@clerk/backend
-
clockSkewInSeconds
was renamed toclockSkewInMs
but the default value stayed the same. That change affects all methods related toVerifyJwtOptions
.Also the following types are affected:
import type { VerifyJwtOptions } from "@clerk/backend/jwt"
import type { VerifyTokenOptions } from "@clerk/backend"
import type { AuthenticateRequestOptions } from "@clerk/backend/internal"
-
Replace
organizations.getPendingOrganizationInvitationList
withorganizations.getOrganizationInvitationList
and pass astatus
parameter.- clerkClient.organizations.getPendingOrganizationInvitationList({ - ...params - }) + clerkClient.organizations.getOrganizationInvitationList({ + ...params, status: ["pending"] + })
Some more niche use cases and their changes.
@clerk/clerk-js
-
The
getOrganizationMemberships()
method on theClerk
class has been removed. UsegetOrganizationMemberships()
on auser
instance instead.const clerk = new Clerk() - clerk.getOrganizationMemberships() + clerk.user.getOrganizationMemberships()
Also note that the response has changed from
Array<Organization>
to{ totalCount: number; data: Array<Organization> }
. -
Organization.create()
has a new function signature.const clerk = new Clerk() - clerk.organization.create("example") + clerk.organization.crete({ name: "example" })
-
Removed
Organization.getPendingInvitations()
, you need to useOrganization.getInvitations()
instead.const clerk = new Clerk() - clerk.organization.getPendingInvitations() + clerk.organization.getInvitations({ status: "pending" })
-
In
User.createExternalAccount()
theredirect_url
parameter was renamed toredirectUrl
. -
In
Signup.attemptWeb3WalletVerification()
the parameters have changed. Usesignature
instead ofidentifier
.const clerk = new Clerk() - clerk.client.signUp.attemptWeb3WalletVerification({ identifier: "" }) + clerk.client.signUp.attemptWeb3WalletVerification({ signature: "" })
-
The
Clerk.isReady()
method has been removed. You can use theClerk.loaded
property instead.const clerk = new Clerk() - clerk.isReady() + clerk.loaded
Other packages
@clerk/clerk-sdk-node
Use @clerk/clerk-sdk-node
as an import, regardless of using CJS or ESM.
- import { } from "@clerk/clerk-sdk-node/cjs/instance" - import { } from "@clerk/clerk-sdk-node/esm/instance" + import { } from "@clerk/clerk-sdk-node"
Community resources
Know a good resource for upgrading from v4 to v5? Edit this page and add a link below!
Known issues
Please check the GitHub issues for any reported issues, or file an issue yourself.