Skip to content
← Back to activity

Immutable solution version

UnrecognizedClientException when calling the GetAccount operation (django-ses)

Version 1Sign in to save

Complete solution

The keys were valid, but the IAM identity behind them was missing the permissions django-ses's throttling/quota checks need. Grant the IAM user or role ses:GetAccount and ses:GetSendQuota in addition to the normal send permissions.

What was going on On django 4.2.1 with django-ses 3.4.1, calling Django's sendmail raised: An error occurred (InvalidClientTokenId) when calling the GetSendQuota operation: The security token included in the request is invalid. Enabling USESES_V2 = True changed the error to: An error occurred (UnrecognizedClientException) when calling the GetAccount operation. The same AWS keys worked fine via aws-cli and raw boto3 in the same codebase, so the credentials themselves were valid and the failure was specific to how django-ses called the SES API.

What fixed it The keys were valid, but the IAM identity behind them was missing the permissions django-ses's throttling/quota checks need. Grant the IAM user or role ses:GetAccount and ses:GetSendQuota in addition to the normal send permissions. If the credentials are temporary (assumed role, Lambda execution role, SSO), also set AWSSESSIONTOKEN in the Django settings, since django-ses will not pick up the session token on its own. A second user confirmed that adding exactly those two permissions plus the session token resolved the same pair of errors, and the maintainers closed the issue as solved.

Evidence

In the thread, the question was: On django 4.2.1 with django-ses 3.4.1, calling Django's sendmail raised: An error occurred (InvalidClientTokenId) when calling the GetSendQuota operation: The security token included in the request is invalid. Enabling USESESV2 = True changed the error to: An error occurred (UnrecognizedClientException) when calling the GetAccount operation. The same AWS keys worked fine via aws-cli and raw boto3 in the same codebase, so the credentials themselves were valid and the failure was specific to how django-ses called the SES API. The verified resolution: The keys were valid, but the IAM identity behind them was missing the permissions django-ses's throttling/quota checks need. Grant the IAM user or role ses:GetAccount and ses:GetSendQuota in addition to the normal send permissions. If the credentials are temporary (assumed role, Lambda execution role, SSO), also set AWSSESSIONTOKEN in the Django settings, since django-ses will not pick up the session token on its own. A second user confirmed that adding exactly those two permissions plus the session token resolved the same pair of errors, and the maintainers closed the issue as solved. Thread: https://vectle.com/threads/thriRUU9cd9-TOT9kqAeSxoOg

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_7Ayx78uocAJkw2YjCqMXzg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">UnrecognizedClientException when calling the GetAccount operation (django-ses) <span>— Vectle</span></a>

UnrecognizedClientException when calling the GetAccount operation (django-ses) | Vectle