git hub actions deployment error

After this new fly.io change I can no longer run the github actions that I had in my project, I received the email to perform the commands:

  • update flyctl to the latest version
  • run fly config save to pull in the latest fly.toml format

Status: Downloaded newer image for heroku/heroku:20-cnb
Error: failed to fetch an image or build from source: executing lifecycle: http: invalid Host header

My fly.tom that started giving an error when trying to deploy:

# fly.toml file generated for po-sample-api on 2022-09-29T18:26:31-03:00

app = "po-sample-api"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
  builder = "heroku/buildpacks:20"

[env]
  PORT = "8080"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

My fly.tom after performing the command I received via email:

# fly.toml app configuration file generated for po-sample-api on 2023-07-12T14:36:30-03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "po-sample-api"
primary_region = "gru"
kill_signal = "SIGINT"
kill_timeout = "5s"

[experimental]
  auto_rollback = true

[build]
  builder = "heroku/buildpacks:20"

[env]
  PORT = "8080"

[[services]]
  protocol = "tcp"
  internal_port = 8080
  processes = ["app"]

  [[services.ports]]
    port = 80
    handlers = ["http"]
    force_https = true

  [[services.ports]]
    port = 443
    handlers = ["tls", "http"]
  [services.concurrency]
    type = "connections"
    hard_limit = 25
    soft_limit = 20

  [[services.tcp_checks]]
    interval = "15s"
    timeout = "2s"
    grace_period = "1s"
    restart_limit = 0

main.yml:


name: Fly Deploy

on:
  workflow_dispatch:
  push:
    branches:
      - main

env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: superfly/flyctl-actions/setup-flyctl@master

      - run: flyctl deploy --local-only --no-cache

Hi there!

I also use a similar setup for Fly.io for one of my Go applications.
And, I faced this same error today.

One workaround I’m using is to deploy via the Fly.io Free Builder instead of building the Docker image locally.

For your example, it would be as simple as changing the last step in the GitHub Actions workflow to:

flyctl deploy --remote-only

Aside: I think one of the core issues behind this problem could be the Go 1.20.6 version patch. Here is a ticket to track the discussion: Golang client fails to attach to streams with "http: invalid Host header" with go1.20.6, go1.19.11 · Issue #45935 · moby/moby · GitHub.
However, I’m not 100% certain this is the root cause - just me thinking out loud.

Hi sorry I had this pulled up and wound up off looking at the issue and forgetting to respond to you here.

We just discovered this issue and @kxsh you’re spot on;

We’re pinning our Go version for flyctl as I type and releasing v0.1.56 shortly which should resolve this for folks always on latest.

@jose0101 another option would I think be to pin to v0.1.54 until 0.1.56 goes out in a moment

v0.1.56 is out and tests passing that were previously broken for similar cases as you describe so you shouldn’t have to change anything - rerunning should show it working now.

1 Like

I changed the .toml file as it was before and now it’s working again. Thank you very much for the support. @jphenow and @kxsh

1 Like