@clerk/nextjs
7.10.2 · 17 Nov 2026MIT4.1M / weekRepositoryHomepagenpmAtom feed
4.31.8 is the newest release of 4.x.
In short
3 new5 fixed4 internal
Security
1 advisory affects 4.20.0; 4.29.3 fixes them
- Critical@clerk/nextjs auth() and getAuth() methods vulnerable to insecure direct object reference (IDOR) GHSA-q6w5-jg5q-47vg · 12 Jan 2024Fixed in 4.29.3
Release note
Minor Changes
Add support for NextJS applications hosted on AWS Amplify
Tweaked the default
authMiddlewarebehavior for protected API routes. An unauthenticated request for a protected API route will no longer return a307 Redirect- a401 Unauthorizedresponse 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/jsonOr, the request method is not one of:
GET,OPTIONS,HEAD
A new
apiRoutesparam has been introduced onauthMiddleware. It can accept an array of path patterns,RegexExpor strings. IfapiRoutesis passed in explicitly, then it overrides the behavior described above and only the requests matchingapiRouteswill 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
redirectToSignInorredirectToSignUp.Improve debug logging by including
AuthObject.debug()data whendebugistrueinauthMiddlewareESM/CJS support for
@clerk/clerk-reactChanges 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/sharedand@clerk/nextjsare 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
clerkJSVersionprop has been added on ClerkProvider allowing to fetch a specific clerk-js version.
authMiddlewarehandles 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.