Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 470
chore(repo): upgrade monorepo to Node.js 24#8351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9fcc619d50f6746d4945a9bf6afa711329cd70ee79e9f8d1a8d745198619779b736bc2a14d93405d014c7913812844e18cd0bffa306f4e3c878fbb87f3767c02b5a08b24182f302a2aee967b12f2d0a4fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| '@clerk/backend': patch | ||
| '@clerk/react-router': patch | ||
| '@clerk/tanstack-react-start': patch | ||
| --- | ||
| Fix `Request` cloning and outbound `fetch` to omit cross-realm `AbortSignal`. Node 24's bundled undici tightened the `instanceof AbortSignal` check on `RequestInit.signal`, which broke: | ||
| - Cloning framework-specific requests such as `NextRequest` in `@clerk/backend`'s `ClerkRequest`. | ||
| - Subclassed `Request`s passed through `patchRequest` in `@clerk/react-router` and `@clerk/tanstack-react-start`. | ||
| - Frontend API proxying in `@clerk/backend`'s `clerkFrontendApiProxy`, which forwarded the inbound request's signal to the upstream `fetch`. Abort propagation will be restored in a follow-up via an in-realm `AbortController` bridge. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 22.11.0 | ||
| 24.15.0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -26,7 +26,25 @@ class ClerkRequest extends Request { | ||
| // https://github.com/nodejs/undici/issues/2155 | ||
| // https://github.com/nodejs/undici/blob/7153a1c78d51840bbe16576ce353e481c3934701/lib/fetch/request.js#L854 | ||
| const url = typeof input !== 'string' && 'url' in input ? input.url : String(input); | ||
| super(url, init || typeof input === 'string' ? undefined : input); | ||
| // When cloning a Request by passing it as init, hide its `signal`. Undici's | ||
| // Request constructor in Node 24 performs a strict instanceof check on the | ||
| // signal and rejects ones from a different realm (e.g. NextRequest). Using a | ||
| // Proxy keeps property access lazy so environments that don't implement | ||
| // optional getters (e.g. Cloudflare Workers' Request lacks `cache`) still work. | ||
| let cloneInit: RequestInit | undefined; | ||
| if (init) { | ||
| cloneInit = init; | ||
| } else if (typeof input !== 'string') { | ||
| cloneInit = new Proxy(input as Request, { | ||
| get(target, prop) { | ||
| if (prop === 'signal') { | ||
| return undefined; | ||
| } | ||
| return Reflect.get(target, prop, target); | ||
| }, | ||
| }) as unknown as RequestInit; | ||
| } | ||
| super(url, cloneInit); | ||
Comment on lines
+29
to
+47
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can confirm this makes sense. Undici validates https://github.com/nodejs/undici/blob/main/lib/web/fetch/request.js#L1077-L1085 | ||
| this.clerkUrl = this.deriveUrlFromHeaders(this); | ||
| this.cookies = this.parseCookies(this); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -135,12 +135,14 @@ export const wrapWithClerkState = (data: any) => { | ||
| * @internal | ||
| */ | ||
| export const patchRequest = (request: Request) => { | ||
| // Omit `signal` from the clone: Node 24's bundled undici tightened the | ||
| // instanceof AbortSignal check, which rejects cross-realm signals (e.g. | ||
| // those carried by framework Request subclasses). | ||
jacekradko marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| const clonedRequest = new Request(request.url, { | ||
| headers: request.headers, | ||
| method: request.method, | ||
| redirect: request.redirect, | ||
| cache: request.cache, | ||
| signal: request.signal, | ||
| }); | ||
| // If duplex is not set, set it to 'half' to avoid duplex issues with unidici | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.