Packages

@clerk/nextjs

7.10.2 · 17 Nov 2026MIT4.1M / weekRepositoryHomepagenpmAtom feed

Your version

4.20.0

9 Jun 2023Where it was published

4.31.8 is the newest release of 4.x.

npm marks 4.20.0 as deprecated: A critical security vulnerability that affects versions in the range of >= 4.7.0,< 4.29.3 has been discovered by the Clerk team. Please upgrade immediately to 4.29.3. For more information, refer to clerk.com/changelog/2024-01-12

In short

3 new5 fixed4 internal

Security

1 advisory affects 4.20.0; 4.29.3 fixes them

Release note

Minor Changes

  • Add support for NextJS applications hosted on AWS Amplify

  • Tweaked the default authMiddleware behavior for protected API routes. An unauthenticated request for a protected API route will no longer return a 307 Redirect - a 401 Unauthorized response will be returned instead.

    With this change, an API route is considered a request for which the following rules apply:

    • The request url matches the following patterns; ['/api/(.*)', '/trpc/(.*)']

    • Or, the request has Content-Type: application/json

    • Or, the request method is not one of: GET, OPTIONS , HEAD

    A new apiRoutes param has been introduced on authMiddleware. It can accept an array of path patterns, RegexExp or strings. If apiRoutes is passed in explicitly, then it overrides the behavior described above and only the requests matching apiRoutes will be considered as API routes requests.
    For more technical details, refer to the PR's description.

  • Add support for NextJS applications hosted on Railway

Patch Changes

  • Improve debug logs in NextJS by adding AuthStatusObject.debug data

  • The devBrowser JWT is now added to all cross-origin redirects triggered by calling redirectToSignIn or redirectToSignUp.

  • Improve debug logging by including AuthObject.debug() data when debug is true in authMiddleware

  • ESM/CJS support for @clerk/clerk-react

    Changes that should affect users and OS contributors:

    • Better source map support for @clerk/clerk-react, @clerk/shared. This affects anyone developing in our monorepo or anyone using a debugger with Clerk installed in their app.

    • Easier node_modules debugging as @clerk/clerk-react, @clerk/shared and @clerk/nextjs are no longer getting bundled as a single-file package. This also improves error logging in nextjs a lot, as nextjs usually logs the line that threw the error - a minified, single-file package, usually consists of a very long single-line module, so logging error in NextJS wasn't ideal.

    • Headless clerk-js bundle size reduced by ~10kb, normal clerk-ks by ~6kb

    • A new clerkJSVersion prop has been added on ClerkProvider allowing to fetch a specific clerk-js version.

  • authMiddleware handles multi-domain relared properties passed as functions properly

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.