Skip to content

Commit f07722e

Browse files
committed
fix(astro): Pass options to clerkClient and remove unused parameters
Fix unused parameters and ensure options are properly passed through the call chain, matching React Router's pattern exactly. Changes: 1. clerk-client.ts: - Update clerkClient signature to accept optional options parameter - Now matches React Router: clerkClient(context, options?) - Allows keyless service to override client configuration 2. keyless/index.ts: - Pass options parameter to clerkClient() calls - Options now used in createAccountlessApplication - Options now used in completeOnboarding - Fixes unused parameter warning 3. clerk-middleware.ts: - Remove unused 'error' variable in catch block - Use empty catch block (matches React Router pattern) 4. keyless/utils.ts: - Fix import sorting (ESLint auto-fix) Benefits: ✅ No unused parameters ✅ Options properly passed through call chain ✅ clerkClient can be overridden with custom config ✅ Matches React Router pattern exactly ✅ All ESLint errors resolved ✅ All TypeScript type checks pass
1 parent 2ed5c1a commit f07722e

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/astro/src/server/clerk-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ const createClerkClientWithOptions: CreateClerkClientWithOptions = (context, opt
2929
...options,
3030
});
3131

32-
const clerkClient = (context: APIContext) => createClerkClientWithOptions(context);
32+
const clerkClient = (context: APIContext, options?: ClerkOptions) => createClerkClientWithOptions(context, options);
3333

3434
export { clerkClient };

packages/astro/src/server/clerk-middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const clerkMiddleware: ClerkMiddleware = (...args: unknown[]): any => {
110110
...(keylessResult.secretKey && { secretKey: keylessResult.secretKey }),
111111
};
112112
}
113-
} catch (error) {
113+
} catch {
114114
// Silently fail - continue without keyless
115115
}
116116
}

packages/astro/src/server/keyless/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export async function keyless(
4545
api: {
4646
async createAccountlessApplication(requestHeaders?: Headers) {
4747
try {
48-
return await clerkClient(context).__experimental_accountlessApplications.createAccountlessApplication({
48+
return await clerkClient(
49+
context,
50+
options,
51+
).__experimental_accountlessApplications.createAccountlessApplication({
4952
requestHeaders,
5053
});
5154
} catch {
@@ -56,6 +59,7 @@ export async function keyless(
5659
try {
5760
return await clerkClient(
5861
context,
62+
options,
5963
).__experimental_accountlessApplications.completeAccountlessApplicationOnboarding({
6064
requestHeaders,
6165
});

packages/astro/src/server/keyless/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { resolveKeysWithKeylessFallback as sharedResolveKeysWithKeylessFallback
22
import type { APIContext } from 'astro';
33
export type { KeylessResult } from '@clerk/shared/keyless';
44

5-
import type { ClerkAstroMiddlewareOptions } from '../clerk-middleware';
65
import { canUseKeyless } from '../../utils/feature-flags';
6+
import type { ClerkAstroMiddlewareOptions } from '../clerk-middleware';
77
import { keyless } from './index';
88

99
/**

0 commit comments

Comments
 (0)