Releases: clerk/javascript
Releases · clerk/javascript
@clerk/[email protected]
Patch Changes
- Updating the CLI output to match the DX of core-1 to core-2 migration (#4393) by @jacekradko
@clerk/[email protected]
Patch Changes
- Adding fallback to properly link up transform (#4386) by @jacekradko
@clerk/[email protected]
Minor Changes
-
@clerk/nextjs: Converting auth() and clerkClient() interfaces to be async (#4366) by @jacekradko
@clerk/upgrade: Adding required codemod for @clerk/nextjs breaking changes
Migration guide
auth()
is now asyncPreviously the
auth()
method from@clerk/nextjs/server
was synchronous.import { auth } from "@clerk/nextjs/server"; export function GET() { const { userId } = auth(); return new Response(JSON.stringify({ userId })); }
The
auth
method now becomes asynchronous. You will need to make the following changes to the snippet above to make it compatible.- export function GET() { + export async function GET() { - const { userId } = auth(); + const { userId } = await auth(); return new Response(JSON.stringify({ userId })); }
Clerk middleware auth is now async
import { clerkClient, clerkMiddleware } from '@clerk/nextjs/server'; import { NextResponse } from 'next/server'; export default clerkMiddleware(async (auth, request) => { const resolvedAuth = await auth(); const count = await resolvedAuth.users.getCount(); if (count) { return NextResponse.redirect(new URL('/new-url', request.url)); } }); export const config = { matcher: [...], };
clerkClient() is now async
Previously the
clerkClient()
method from@clerk/nextjs/server
was synchronous.import { clerkClient, clerkMiddleware } from '@clerk/nextjs/server'; import { NextResponse } from 'next/server'; export default clerkMiddleware((auth, request) => { const client = clerkClient(); const count = await client.users?.getCount(); if (count) { return NextResponse.redirect(new URL('/new-url', request.url)); } }); export const config = { matcher: [...], };
The method now becomes async. You will need to make the following changes to the snippet above to make it compatible.
- export default clerkMiddleware((auth, request) => { - const client = clerkClient(); + export default clerkMiddleware(async (auth, request) => { + const client = await clerkClient(); const count = await client.users?.getCount(); if (count) { }
@clerk/[email protected]
Patch Changes
-
Update internal dependencies to use public version ranges instead of file-based paths (#4397) by @LekoArts
-
Updated dependencies [
3fdcdbf88
]:- @clerk/[email protected]
- @clerk/[email protected]
- @clerk/[email protected]
@clerk/[email protected]
@clerk/[email protected]
@clerk/[email protected]
Patch Changes
- Updated dependencies [
3fdcdbf88
]:- @clerk/[email protected]
@clerk/[email protected]
Patch Changes
- Updated dependencies [
3b50b67bd
,3b50b67bd
]:- @clerk/[email protected]
@clerk/[email protected]
Patch Changes
- Updated dependencies [
3fdcdbf88
,1c7e105a3
]:- @clerk/[email protected]
- @clerk/[email protected]
- @clerk/[email protected]
@clerk/[email protected]
Patch Changes
- Updated dependencies [
93dfe7a09
,3b50b67bd
,3b50b67bd
]:- @clerk/[email protected]
- @clerk/[email protected]
- @clerk/[email protected]