Skip to content

Commit

Permalink
Fix noisy deprecations sdk node (#1856)
Browse files Browse the repository at this point in the history
* chore(backend,clerk-sdk-node): Fix always showing deprecation warning for frontendApi

* chore(clerk-sdk-node): Fix always showing deprecation warning for apiKey
  • Loading branch information
dimkl committed Oct 10, 2023
1 parent 7fb2296 commit 3848f8d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
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 || '',
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

0 comments on commit 3848f8d

Please sign in to comment.