Problem with deploying from Github Actions and multiple toml files

I’ve got a weird issue setting up a new app with two environments, each has its own toml file. I would appreciate some help

Command

flyctl deploy --remote-only --config fly.staging.toml runs from console without any issues but fails from github workflow with

Github Action output

Run flyctl deploy --remote-only --config fly.staging.toml
==> Verifying app config
Validating fly.staging.toml
Error: Your fly.toml referenced an attribute 'swap_size_mb' but it is unknown. Double check the accepted attributes in fly.toml https://fly.io/docs/reference/configuration
WARNING: Failed to fetch platform version: Could not find App "appname-staging"
Error: Process completed with exit code 1.

Github Action file

name: Deploy to Staging

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
      FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

    steps:
      - uses: actions/checkout@v4
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --remote-only --config fly.staging.toml

fly.staging.toml

app = "appname-staging"
primary_region = "fra"
kill_signal = "SIGTERM"
swap_size_mb = 512

[deploy]
  release_command = "/app/bin/migrate"

[env]
  PHX_HOST = "staging.appname.com"
  PORT = "8080"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 1
  processes = ["app"]
  [http_service.concurrency]
    type = "connections"
    hard_limit = 1000
    soft_limit = 1000

From a purely “I just looked at this quickly” stand point, is your version of flyctl the same as the GH one?

2 Likes

hi @userbradley

the github version is from today

> Run flyctl version
flyctl v0.1.127 linux/amd64 Commit: a1c60ede67a656d0ef931f12042c2d34119cefe5 BuildDate: 2023-11-17T13:43:12Z

and the local one is two days old, and it says it is the latest one

> fly version
fly v0.1.126 darwin/amd64 Commit: 4d1564748f7e44cbf72746852e224d1ab66310b9 BuildDate: 2023-11-15T22:05:20Z

both should be able to support swap

Check that there isn’t a space or newline in the FLY_API_TOKEN github secret. I don’t know why but occasionally this happens and the token doesn’t work. You can try running fly auth whoami before the deploy to verify that the token works and the user matches what you expect.

1 Like

Thanks @michael, the issue was with the wrong deploy token, it belonged to another app. Adding - run: flyctl apps list helped me to discover it.

That 'swap_size_mb' is unknown error was really confusing.

What I’ve learned from support:

Being unable to get the platform version causes the Fly API to fall back to an old validation mechanism which then throws the " Your fly.toml referenced an attribute ‘swap_size_mb’ but it is unknown".

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.