Skip to content

Commit ba17d53

Browse files
committed
fix(credentials): report an oversized Databricks token success as a 502
An oversized 2xx token reply carried status 200 into provider_unavailable and its logs. A refusal keeps its own status.
1 parent 5e07f86 commit ba17d53

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎apps/sim/lib/credentials/databricks-service-account.server.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ describe('getting a Databricks token for a run', () => {
194194

195195
await expect(resolveDatabricksCredentialToken('cred-1')).rejects.toMatchObject({
196196
code: 'provider_unavailable',
197+
status: 502,
197198
logDetail: { reason: 'Databricks token response exceeded the size limit' },
198199
})
199200
})

‎apps/sim/lib/credentials/databricks-service-account.server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ async function requestWorkspaceToken(
153153
if (error instanceof SyntaxError) return {}
154154
signal?.throwIfAborted()
155155
if (isPayloadSizeLimitError(error)) {
156+
// A refusal's status still holds; an oversized success is the provider misbehaving.
156157
throw new DatabricksCredentialError(
157158
'Databricks token response exceeded the size limit',
158-
response.status
159+
response.ok ? 502 : response.status
159160
)
160161
}
161162
// An interrupted body says nothing about the credential, whatever the status line was.

0 commit comments

Comments
 (0)