Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/tasty-toes-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-sdk-node': patch
'@clerk/backend': patch
---

Avoid always showing deprecation warnings for `frontendApi` and `apiKey` in `@clerk/clerk-sdk-node`
2 changes: 1 addition & 1 deletion packages/backend/src/tokens/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function createAuthenticateRequest(params: CreateAuthenticateRequestOptio
apiUrl,
frontendApi: runtimeFrontendApi || buildtimeFrontendApi,
publishableKey: runtimePublishableKey || buildtimePublishableKey,
proxyUrl: (runtimeProxyUrl || buildProxyUrl) as any,
proxyUrl: runtimeProxyUrl || buildProxyUrl,
isSatellite: runtimeIsSatellite || buildtimeIsSatellite,
domain: (runtimeDomain || buildtimeDomain) as any,
userAgent: runtimeUserAgent || buildUserAgent,
Expand Down
4 changes: 3 additions & 1 deletion packages/sdk-node/src/authenticateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export async function loadInterstitial({
*/
if (requestState.publishableKey || requestState.frontendApi) {
return clerkClient.localInterstitial({
frontendApi: requestState.frontendApi,
// Use frontendApi only when legacy frontendApi is used to avoid showing deprecation warning
// since the requestState always contains the frontendApi constructed by publishableKey.
frontendApi: requestState.publishableKey ? '' : requestState.frontendApi,
publishableKey: requestState.publishableKey,
proxyUrl: requestState.proxyUrl,
signInUrl: requestState.signInUrl,
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-node/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const loadClientEnv = () => {
export const loadApiEnv = () => {
return {
secretKey: process.env.CLERK_SECRET_KEY || process.env.CLERK_API_KEY || '',
apiKey: process.env.CLERK_SECRET_KEY || process.env.CLERK_API_KEY || '',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there usages of apiKey that assume it has been defaulted to CLERK_SECRET_KEY?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's a typo or an attempt to be "extra" safe that the env is used.

apiKey: process.env.CLERK_API_KEY || '',
apiUrl: process.env.CLERK_API_URL || 'https://api.clerk.dev',
apiVersion: process.env.CLERK_API_VERSION || 'v1',
domain: process.env.CLERK_DOMAIN || '',
Expand Down