Skip to content

Commit 335d662

Browse files
Remove promise all logic
1 parent ed4fb1b commit 335d662

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

apps/sim/lib/api-key/service.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,16 @@ export async function authenticateApiKeyFromHeader(
7171
}
7272

7373
try {
74-
const [workspaceSettings, hashCandidate] = await Promise.all([
75-
options.workspaceId ? getWorkspaceBillingSettings(options.workspaceId) : null,
76-
lookupByHash(apiKeyHeader),
77-
])
74+
let workspaceSettings: WorkspaceBillingSettings | null = null
7875

79-
if (options.workspaceId && !workspaceSettings) {
80-
return { success: false, error: 'Workspace not found' }
76+
if (options.workspaceId) {
77+
workspaceSettings = await getWorkspaceBillingSettings(options.workspaceId)
78+
if (!workspaceSettings) {
79+
return { success: false, error: 'Workspace not found' }
80+
}
8181
}
8282

83+
const hashCandidate = await lookupByHash(apiKeyHeader)
8384
if (hashCandidate !== null) {
8485
return await applyHashGates(hashCandidate, options, workspaceSettings)
8586
}

0 commit comments

Comments
 (0)