Skip to content

Commit 2813fa4

Browse files
chore(react-router): Pass options from middleware to clerkClient (#7292)
Co-authored-by: Robert Soriano <sorianorobertc@gmail.com>
1 parent e6ad12f commit 2813fa4

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.changeset/khaki-cows-sell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/react-router': minor
3+
---
4+
5+
Options passed to `clerkMiddleware` are now properly forwarded to `clerkClient`, ensuring consistent configuration when manually providing options from router context.

packages/react-router/src/server/clerkClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { createClerkClient } from '@clerk/backend';
22

33
import { type DataFunctionArgs, loadOptions } from './loadOptions';
4+
import type { ClerkMiddlewareOptions } from './types';
45

5-
export const clerkClient = (args: DataFunctionArgs) => {
6-
const options = loadOptions(args);
6+
export const clerkClient = (args: DataFunctionArgs, overrides: ClerkMiddlewareOptions = {}) => {
7+
const options = loadOptions(args, overrides);
78

89
const { apiUrl, secretKey, jwtKey, proxyUrl, isSatellite, domain, publishableKey, machineSecretKey } = options;
910

packages/react-router/src/server/clerkMiddleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const clerkMiddleware = (options?: ClerkMiddlewareOptions): MiddlewareFun
5555
organizationSyncOptions,
5656
} = loadedOptions;
5757

58-
const requestState = await clerkClient(args).authenticateRequest(clerkRequest, {
58+
const requestState = await clerkClient(args, options).authenticateRequest(clerkRequest, {
5959
apiUrl,
6060
secretKey,
6161
jwtKey,

0 commit comments

Comments
 (0)