disables AWS key on AccessDeniedException

This commit is contained in:
nai-degen 2023-10-02 11:18:08 -05:00
parent d2267beb18
commit ede274c117
1 changed files with 5 additions and 0 deletions

View File

@ -306,6 +306,11 @@ const handleUpstreamErrors: ProxyResHandlerWithBody = async (
errorPayload.proxy_note = `API key is invalid or revoked. ${tryAgainMessage}`;
break;
case "AccessDeniedException":
req.log.error(
{ key: req.key?.hash, model: req.body?.model },
"Disabling key due to AccessDeniedException when invoking model. If credentials are valid, check IAM permissions."
);
keyPool.disable(req.key!, "revoked");
errorPayload.proxy_note = `API key doesn't have access to the requested resource.`;
break;
default: