Skip to content

Commit 2b33a0e

Browse files
fix(credentials): use the shared outage predicate on the session update path
1 parent 5ed0cad commit 2b33a0e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • apps/sim/app/api/credentials/[id]

apps/sim/app/api/credentials/[id]/route.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { getValidationErrorMessage, parseRequest } from '@/lib/api/server'
55
import { getSession } from '@/lib/auth'
66
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
77
import { type CredentialActorContext, getCredentialActorContext } from '@/lib/credentials/access'
8-
import { performDeleteCredential, performUpdateCredential } from '@/lib/credentials/orchestration'
8+
import {
9+
isProviderOutageCode,
10+
performDeleteCredential,
11+
performUpdateCredential,
12+
} from '@/lib/credentials/orchestration'
913

1014
const logger = createLogger('CredentialByIdAPI')
1115

@@ -101,7 +105,9 @@ export const PUT = withRouteHandler(
101105
? 409
102106
: // A provider outage during reconnect is infra, not a bad
103107
// request — mirror the create route and runtime token route.
104-
result.providerErrorCode === 'provider_unavailable'
108+
// Every provider family names its own outage code, so this
109+
// asks the shared predicate rather than matching one literal.
110+
isProviderOutageCode(result.providerErrorCode)
105111
? 502
106112
: result.errorCode === 'validation'
107113
? 400

0 commit comments

Comments
 (0)