Using Flyctl from GitHub Actions

I’m trying to do something really basic here and must be missing something.

I’m using GitHub actions w/ a custom docker container that has flyctl setup. I read that if I set FLY_ACCESS_TOKEN it’d just work, so I tossed an access token in as an encrypted org secret, and setup this action:

  - name: Push Container to Fly.io
    env:
      FLY_ACCESS_TOKEN: ${{ secrets.FLY_ACCESS_TOKEN }}
    run: flyctl deploy --app $APP_NAME --image $CONTAINER_NAME

This seems like the perfect solution (kudos developers), but sadly I get this error:

==> Verifying app config
Error failed fetching existing app config: Post "https://api.fly.io/graphql": net/http: invalid header field value "***" for key Authorization

Any ideas?

Hi @limbic-derek

Does the same key and command work if you run it on your local machine?

Also, you mentioned that you added the token as an encrypted org secret, have you checked that your repo can access the secret? (it’s part of the config for the secrets done at the org level but not at the repo level).

I checked and it can access it just fine. This command works locally as well…This has to do with some kind of filtration on git GitHub Actions side I think but I can’t figure out how to make it know this is OK to do.

Can you check if you need to add anything to your Dockerfile or setup otherwise, with this as reference - GitHub - superfly/flyctl-actions: :octocat: GitHub Action that wraps the flyctl

EDIT: It seems to be something dumb… a newline character at the end of the secret.
Found plenty of hits suggesting the same for net/http: invalid header field value