Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers #770

Closed
snusmu opened this issue Jul 11, 2023 · 4 comments
Labels
bug Something isn't working needs-triage This issue still needs to be triaged

Comments

@snusmu
Copy link

snusmu commented Jul 11, 2023

Describe the bug

I tried using this credential configure action today, with a very basic workflow, but i am getting an error:

Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers

Seemingly someone else also has this error with the workflow while they didnt have it before: #680 (comment)

Expected Behavior

Expected authentication to suceed

Current Behavior

Authentication results in an error

Reproduction Steps

jobs:
  myrepo-test:
    runs-on: ubuntu-latest
    steps:
      - name: Configure credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-region: us-east-1
          role-to-assume: arn:aws:iam::000000000000:role/github-s3-test
          role-session-name: GithubActionDeployment

Role trusted entities in AWS:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws:iam::000000000000:oidc-provider/token.actions.githubusercontent.com"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringEquals": {
                    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
                },
                "StringLike": {
                    "token.actions.githubusercontent.com:sub": "repo: myorg/myrepo:*"
                }
            }
        }
    ]
}

Results in an error like this:

Run aws-actions/configure-aws-credentials@v2
  with:
    aws-region: us-east-1
    role-to-assume: arn:aws:iam::000000000000:role/github-s3-test
    role-session-name: GithubActionDeployment
    audience: sts.amazonaws.com
  env:
    BRANCH_NAME: XXX-mybranch
(node:1641) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers

Possible Solution

No response

Additional Information/Context

No response

@snusmu snusmu added bug Something isn't working needs-triage This issue still needs to be triaged labels Jul 11, 2023
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Jul 11, 2023

Could you post your full workflow file please? Do you have the id-token permission enabled?

We haven't made a change to the v2 tag in a few weeks, so either GitHub changed something on their end, or this workflow file isn't setup properly (though that wouldn't explain why it stopped failing for a couple people last Friday)

@snusmu
Copy link
Author

snusmu commented Jul 11, 2023

allright so in my case it was noob oversight, adding this indeed solved the problem:

permissions:
  id-token: write
  contents: read

@snusmu snusmu closed this as completed Jul 11, 2023
@github-actions
Copy link

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@peterwoodworth
Copy link
Contributor

We'll have a better error message for this in v3 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage This issue still needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants