Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/proxy/edge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export function makeFetchApiSecrets({
}
} else {
const responseText = await response.text();
if (response.status === 400) {
if (response.status === 400 || response.status === 403) {
throw new Error(
`Failed to lookup api key: ${response.status}: ${responseText}`,
Comment on lines +253 to 255

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve 403 status when rethrowing lookup failures

This branch now throws a plain Error for /api/secret 403 responses, but EdgeProxyV1 catches all thrown errors and always returns HTTP 400 (packages/proxy/edge/index.ts, around lines 407-410), so the new 403 path is still not actually propagated to clients. In requests with invalid/forbidden Braintrust credentials, callers that rely on receiving 403 will instead see 400, which misclassifies auth failures and can break client-side handling.

Useful? React with 👍 / 👎.

);
Expand All @@ -261,7 +261,7 @@ export function makeFetchApiSecrets({
} catch (e) {
if (
e instanceof Error &&
e.message.startsWith("Failed to lookup api key: 400:")
e.message.startsWith("Failed to lookup api key:")
) {
throw e;
}
Expand Down
Loading