Error we couldn't find a fly.toml nor an app specified by the -a flag. If you want to launch a new app, use 'flyctl launch'

Whenever I run flyctl deploy --remote-only ./target/docker/stage --config fly.toml on github actions I get the following error —

Error we couldn't find a fly.toml nor an app specified by the -a flag. If you want to launch a new app, use 'flyctl launch'

This works locally on my machine which is a MAC OS. The toml file is present in the folder and the app name also exists. What am I missing?

A very common GitHub Actions mistake is forgetting to checkout your code first, so it could be that you’re doing something like:

steps:
  - uses: superfly/flyctl-actions/setup-flyctl@master
  - run: flyctl deploy --remote-only ./target/docker/stage --config fly.toml

When you actually need to do something like:

steps:
+ - uses: actions/checkout@v3
  - uses: superfly/flyctl-actions/setup-flyctl@master
  - run: flyctl deploy --remote-only ./target/docker/stage --config fly.toml

If you’re already checking out your code: the error message can be a little confusing because the error message actually means that Fly could not identify the app that you’re trying to deploy. A cause of this can be a missing fly.toml but it could also be the absence of a well-formatted app in the fly.toml. There are other ways to specify a fly app, like an Environment Variable, which could be why it’s working in your local environment. Each of the following examples will work even if your fly.toml is missing an app:

FLY_APP="example" fly info
export FLY_APP="example"
fly info
fly info -a example

If you can post your fly.toml here the problem might jump out at someone, alternatively, you could confirm that this is the problem yourself by explicitly specifying your app name in the GitHub Actions command, e.g:

- flyctl deploy --remote-only ./target/docker/stage --config fly.toml
+ flyctl deploy --remote-only ./target/docker/stage --config fly.toml -a example

note: In general, if you’re using the default fly.toml location then you do not need to use the config flag but it shouldn’t cause any problems.

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