OIDC to AWS fails: `Error: Could not assume role with OIDC: Not authorized to perform sts:AssumeRoleWithWebIdentity`.
AdvancedTroubleshootingGitHub Actions Failures
Answer
Likely causes → Trust policy sub condition does not match (branch vs environment form); wrong aud; missing id-token: write; the OIDC provider missing in the account.
Diagnose → Print the sub claim your workflow sends (for example repo:org/app:ref:refs/heads/main or repo:org/app:environment:prod) and compare with the role's trust policy:
aws iam get-role --role-name gha-deploy --query 'Role.AssumeRolePolicyDocument'
Fix → Align the StringLike/StringEquals condition with the real sub and aud: sts.amazonaws.com; add permissions: id-token: write.
Prevent → Keep the trust policy in Terraform with tests per environment.
More on GitHub Actions Failures
Workflow never triggers after pushing. No run appears in the Actions tab.Beginner`Error: Process completed with exit code 1.` with no further detail.Beginner`Error: Resource not accessible by integration` (HTTP 403) when the workflow comments on a PR or pushes a tag.Advanced`Context access might be invalid: SECRET_NAME` and the secret is empty inside the job.Beginner`Unable to resolve action actions/checkout@v5, unable to find version v5`.Beginner`The workflow is not valid. .github/workflows/ci.yml (Line: 14, Col: 9): Unexpected value 'run'`.Beginner