Cannot deploy from GitHub Actions: Failed to start remote builder heartbeat: Not authorized to deploy this app

I’m seeing the same thing. Also seems related to Error: failed to fetch an image or build from source: Not authorized to deploy this app.

If it helps anyone figure this out, these are the logs I’m seeing in Github Actions: use LOG_LEVEL=debug in fly deploy · alostsock/craftingway@fb512b3 · GitHub, which were generated from

flyctl doctor
LOG_LEVEL=debug flyctl deploy --verbose --remote-only

Here’s the relevant (as far as I can tell) bits of debug output:

==> Building image
DEBUG --> POST https://api.fly.io/graphql

DEBUG trying remote docker daemon
DEBUG {
  "query": "query ($appName: String!) { app(name: $appName) { id name organization { id slug paidPlan remoteBuilderApp { id name hostname deployed status version appUrl platformVersion currentRelease { evaluationId status inProgress version } ipAddresses { nodes { id address type createdAt } } organization { id slug paidPlan } imageDetails { registry repository tag digest version } machines{ nodes { id name config state region createdAt app { name } ips { nodes { family kind ip maskSize } } host { id } } } postgresAppRole: role { name } limitedAccessTokens { nodes { id name expiresAt } } } } } }",
  "variables": {
    "appName": "servingway-preview"
  }
}


DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (39.01ms)

DEBUG {
  "data": {
    "app": {
      "id": "servingway-preview",
      "name": "servingway-preview",
      "organization": {
        "id": "yw2NK09lG62eytyo75jV2OwzbVTey2Vjy",
        "slug": "personal",
        "paidPlan": false,
        "remoteBuilderApp": null
      }
    }
  }
}

DEBUG --> POST https://api.fly.io/graphql

DEBUG {
  "query": "mutation($input: CreateAppInput!) { createApp(input: $input) { app { id name organization { slug } config { definition } regions { name code } } } }",
  "variables": {
    "input": {
      "organizationId": "yw2NK09lG62eytyo75jV2OwzbVTey2Vjy",
      "name": "fly-builder-long-sun-6794",
      "preferredRegion": "",
      "appRoleId": "remote-docker-builder",
      "machines": true
    }
  }
}


DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (38.85ms)

DEBUG {
  "data": {
    "createApp": null
  },
  "errors": [
    {
      "message": "Not authorized to deploy this app.",
      "locations": [
        {
          "line": 1,
          "column": 37
        }
      ],
      "path": [
        "createApp"
      ],
      "extensions": {
        "code": "UNAUTHORIZED"
      }
    }
  ]
}