fixes org-ID redaction on errors which don't include one
This commit is contained in:
parent
e0529197cd
commit
119c2f827a
|
@ -293,8 +293,8 @@ const handleDownstreamErrors: ProxyResHandlerWithBody = async (
|
||||||
errorPayload.proxy_note = `Unrecognized error from OpenAI.`;
|
errorPayload.proxy_note = `Unrecognized error from OpenAI.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't leak the org id outside the proxy
|
// Some OAI errors contain the organization ID, which we don't want to reveal.
|
||||||
errorPayload.message.replace(/org-.{24}/gm, "org-xxxxxxxxxxxxxxxxxxx");
|
errorPayload.message?.replace(/org-.{24}/gm, "org-xxxxxxxxxxxxxxxxxxx");
|
||||||
|
|
||||||
res.status(statusCode).json(errorPayload);
|
res.status(statusCode).json(errorPayload);
|
||||||
throw new Error(errorPayload.error?.message);
|
throw new Error(errorPayload.error?.message);
|
||||||
|
|
Loading…
Reference in New Issue