【问题标题】:How to solve botocore.exceptions.NoCredentialsError: Unable to locate credentials如何解决 botocore.exceptions.NoCredentialsError: Unable to locate credentials
【发布时间】:2020-03-24 09:40:54
【问题描述】:

我有一个运行 tox.ini 文件的 GitHub 操作。操作的其中一个步骤是连接到 aws,最后一步是运行 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

由于某种原因,我的操作失败并出现以下错误botocore.exceptions.NoCredentialsError: Unable to locate credentials
我不确定为什么会发生这种情况,尤其是因为 aws 配置步骤正在传递操作

【问题讨论】:

    标签: amazon-web-services boto tox


    【解决方案1】:

    设置凭据后仍然出现此错误的原因是aws-actions/configure-aws-credentials 设置了环境变量,而 tox 默认情况下不传递环境变量。您可以告诉 tox 传递 tox.ini 文件中的变量。像这样的:

    [testenv]
    passenv = AWS_*
    

    【讨论】:

    • 非常感谢。这个问题困扰了我好几天。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-10
    • 1970-01-01
    • 2018-10-03
    • 2016-06-28
    • 1970-01-01
    • 1970-01-01
    • 2021-03-30
    相关资源
    最近更新 更多