简体   繁体   中英

How to solve botocore.exceptions.NoCredentialsError: Unable to locate credentials

I have a GitHub action which is running a tox.ini file. One of the steps of the action is to connect to aws and the last step is to run tox

- name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.key }}
        aws-secret-access-key: ${{ secrets.secret_key }}
        aws-region: ${{ secretes.region }}
- name: Run tox
      run: tox

And for some reason my action fails with the following error botocore.exceptions.NoCredentialsError: Unable to locate credentials
I'm not sure why this is happening especially since the aws configuration step is passing in the action

The reason you still get this error after setting credentials is because the aws-actions/configure-aws-credentials sets environment variables and tox, by default, does not pass along env vars. You can tell tox to pass the variables in your tox.ini file. Something like this:

[testenv]
passenv = AWS_*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM