When using AWS ECR, Github Action fails running the aws-actions/configure-aws-credentials action with Error: "Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers"

View in #prefect-server on Slack

madhav @madhav: Hi All, figured I’d ask here in case anyone has experience with this. We are deploying ECR containers that have all of our flows using github actions, however the github action fails running the aws-actions/configure-aws-credentials action with Error: Credentials could not be loaded, please check your action inputs: Could not load credentials from any providers. Has anyone seen this error before when trying to package their flows into a container?

Anna_Geller @Anna_Geller: We actually have seen similar issues recently. Check this Github issue

It may not be directly Prefect-related though - could be some change in credentials handling on the GHA with ECR

GitHub: Flow registration with Docker storage can’t push the image to ECR due to InterruptedError: no basic auth credentials · Issue #5707 · PrefectHQ/prefect

can you say more when do you see this error? Does it happen during flow registration when using Docker storage or when you manually push your custom image?

madhav @madhav: Got it, yea I think it may be a github issue as well. We have a github action that tries to push an ECR image with all of our flows on commit. @Chris_Hatton
I’ll post any updates we have with it here.

Jason @Jason: That’s odd. The following works for me at that step:

 - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-1

I do get a downstream failure when pushing ECR with the flow.registration, and get around it by manually pushing the image to ECR in a separate step.
Then following that step I run aws-actions/amazon-ecr-login@v1 to authenticate to ECR.

madhav @madhav: oh hmm. yea that exact snippet you post is where we fail

Anna_Geller @Anna_Geller: perhaps you can recreate your AWS key pair? could be that your credentials are no longer valid (even though the error message should be different then)

madhav @madhav: we just fixed the issue. It was a silly configuration issue: We had “Environment Secrets” not “Repository Secrets” in the repo. ugh. Thank you for the help everyone. It was useful @Jason to know that our configuration was correct.

Anna_Geller @Anna_Geller: Thanks for sharing your solution! Will cross-post on Discourse