Failing to deploy from Github Actions

I wrote a simple Github Actions workflow to deploy to fly.io:

jobs:
  deploy:
    name: Deploy to fly.io
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --remote-only -c deploy/fly.staging.toml
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

The workflow run consistently fails with the following error message:

Error failed to fetch an image or build from source: error rendering push status stream: unauthorized: not allowed

Deploying locally with the same command (even the same API key) works just fine. What could be the issue here?

What happens before that log line? Is the app = "<name>" in fly.staging.toml correct? That error looks like what happens when it tries to push to a non existent app repository.

Yes the name is correct, I also use the same fly.staging.toml for local deployment and it works fine there. Here are some more log lines before the failure:

2022-07-05T23:35:40.9097698Z #24 exporting to image
2022-07-05T23:35:40.9097914Z #24 exporting layers
2022-07-05T23:35:41.1358274Z #24 exporting layers 0.3s done
2022-07-05T23:35:41.1359297Z #24 writing image sha256:52f7cff73fa0e427e9f989e02811f174954496331a87978981fbdaf83a71f847 done
2022-07-05T23:35:41.1360085Z #24 naming to registry.fly.io/<app-name-redacted>:deployment-1657064124 done
2022-07-05T23:35:41.1360355Z #24 DONE 0.3s
2022-07-05T23:35:41.1360651Z e[38;5;252m--> Building image donee[0m
2022-07-05T23:35:41.1360908Z ==> Pushing image to fly
2022-07-05T23:35:41.2862143Z The push refers to repository [registry.fly.io/cake4-staging]
2022-07-05T23:35:41.2945574Z 764d0ba6462b: Preparing
2022-07-05T23:35:41.2945882Z 2f70ae6af30c: Preparing
2022-07-05T23:35:41.2946106Z 565fe89d0408: Preparing
2022-07-05T23:35:41.2946329Z 9b8c250cfc08: Preparing
2022-07-05T23:35:41.2946534Z df4e10d8b46a: Preparing
2022-07-05T23:35:41.2946779Z 380d3cd46163: Preparing
2022-07-05T23:35:41.2947004Z 97efa73ad4e3: Preparing
2022-07-05T23:35:41.2947215Z 21f5163c4e0b: Preparing
2022-07-05T23:35:41.2947403Z 5f70bf18a086: Preparing
2022-07-05T23:35:41.2947615Z 783aebe53d4a: Preparing
2022-07-05T23:35:41.2947822Z 235f750983d5: Preparing
2022-07-05T23:35:41.2948021Z ad6562704f37: Preparing
2022-07-05T23:35:41.2948208Z 21f5163c4e0b: Waiting
2022-07-05T23:35:41.2948420Z 5f70bf18a086: Waiting
2022-07-05T23:35:41.2948623Z 783aebe53d4a: Waiting
2022-07-05T23:35:41.2948808Z 235f750983d5: Waiting
2022-07-05T23:35:41.2948982Z ad6562704f37: Waiting
2022-07-05T23:35:41.2949176Z 380d3cd46163: Waiting
2022-07-05T23:35:41.2949364Z 97efa73ad4e3: Waiting
2022-07-05T23:35:41.7883688Z Error failed to fetch an image or build from source: error rendering push status stream: unauthorized: not allowed
2022-07-05T23:35:41.7887424Z 
2022-07-05T23:35:41.7887431Z 
2022-07-05T23:35:41.7914222Z ##[error]Process completed with exit code 1.

Update: I re-issued a new API token and set it in Github Action secrets. It works now! I might have accidentally pasted a trailing newline or so when I entered the API token the last time.

Thanks for your support.

1 Like