ERROR REFERENCE
Not authorized to perform: sts:AssumeRoleWithWebIdentity
Your GitHub Actions job reached AWS STS, but the role's trust relationship rejected the GitHub-issued OIDC token. The deployment identity was never established, so everything after this line is noise.
WHAT IT MEANS
What this error means
The workflow asked STS to exchange a GitHub OIDC token for temporary AWS
credentials via AssumeRoleWithWebIdentity, and STS said no.
The token itself arrived, so the network path and the credentials action
are working. The mismatch is between what the token claims and what the
IAM role's trust policy requires. In practice one of three things is wrong:
- The job never got a real token. The workflow or job is missing the
id-token: writepermission, so the credentials action falls back and STS receives nothing it can trust. - The audience does not match. The trust policy checks
token.actions.githubusercontent.com:aud, and the token was minted for something other thansts.amazonaws.com. - The
subcondition does not match this run. The trust policy pins a repository, branch, tag, or GitHub Environment, and the job that ran does not match it exactly — a renamed repo, a deploy from a different branch, or an Environment name that differs from the condition.
FIX
How to fix it
-
Confirm the job can request a token. The workflow or the
deployment job must declare:
A job-levelpermissions: id-token: write contents: readpermissionsblock overrides the workflow-level one, and reusable workflows need the permission granted by the caller. -
Check the audience. The role trust policy should accept
token.actions.githubusercontent.com:audequal tosts.amazonaws.com— that is whataws-actions/configure-aws-credentialsrequests by default. If you passed a customaudienceinput, the trust policy must match it. -
Compare the
subcondition with the actual run. A branch deploy produces a claim likerepo:OWNER/REPO:ref:refs/heads/main; a job bound to a GitHub Environment producesrepo:OWNER/REPO:environment:NAMEinstead. The two forms are not interchangeable. UseStringLikewith an explicit wildcard only where you have decided that breadth is acceptable. Note that newer repositories can include immutable owner and repository IDs in the claim. -
Verify the OIDC provider exists in the target account.
The account needs an IAM OIDC identity provider for
token.actions.githubusercontent.com, and the role's federated principal must name that provider's ARN. Assuming a role in the wrong account is a common variant of this failure. - Re-run the deploy only after a trust-policy check passes. Rotating secrets or widening permissions does not help here — the failure is in the trust relationship, not in an identity policy.
AUTOMATE THE TRIAGE
Diagnose this automatically
SAM Doctor recognizes this failure (high confidence) plus the neighboring
OIDC variants — missing id-token: write, wrong audience, and
missing OIDC provider — and tells you which one your log shows. Runs
locally; no AWS access, no log upload.
python -m pip install sam-doctor
sam-doctor diagnose deployment.log --format markdown
RELATED
Related errors
- The security token included in the request is expired — the credentials worked earlier and then aged out mid-job.
- no basic auth credentials — the OIDC role works but the runner never logged in to ECR.
- InsufficientCapabilitiesException — the identity is fine and CloudFormation wants an explicit IAM acknowledgement.
Longer walkthrough: the OIDC deployment debugging guide.