Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 committed Dec 27, 2024
1 parent 761d82d commit 1a0afff
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/backend/src/lib/api-keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ApiKeysCrud } from '@stackframe/stack-shared/dist/interface/crud/api-ke
import { yupString } from '@stackframe/stack-shared/dist/schema-fields';
import { typedIncludes } from '@stackframe/stack-shared/dist/utils/arrays';
import { generateSecureRandomString } from '@stackframe/stack-shared/dist/utils/crypto';
import { getNodeEnvironment } from '@stackframe/stack-shared/dist/utils/env';
import { StackAssertionError } from '@stackframe/stack-shared/dist/utils/errors';
import { generateUuid } from '@stackframe/stack-shared/dist/utils/uuids';

Expand Down Expand Up @@ -40,12 +41,14 @@ export async function checkApiKeySet(projectId: string, key: KeyType): Promise<b

// In non-prod environments, let's also call the legacy function and ensure the result is the same
// TODO next-release: remove this
const legacy = await checkApiKeySetLegacy(projectId, key);
if (legacy !== result) {
throw new StackAssertionError("checkApiKeySet result mismatch", {
result,
legacy,
});
if (!getNodeEnvironment().includes("prod")) {
const legacy = await checkApiKeySetLegacy(projectId, key);
if (legacy !== result) {
throw new StackAssertionError("checkApiKeySet result mismatch", {
result,
legacy,
});
}
}

return result;
Expand Down

0 comments on commit 1a0afff

Please sign in to comment.