`flyctl secrets import` before first deployment

My understanding is that flyctl secrets set will work before an app has been deployed for the first time, but when I try to do the same with import, the command errors:

Error Could not find App "***-pr-428"

My use case is I’m trying to spin up a brand new “preview app” for each PR in our repo, seeding its secrets with values which are stored in Github Actions. Because I can’t seed the secrets, the launch deployment fails, because the app starting up and becoming healthy requires some of the secret values to be set.

I could ignore the unhealthy deployment and set the secrets afterward, but then a legitimate deployment failure wouldn’t be distinguishable from a “successful” failure in CI, so things would be harder to debug and check.

1 Like

I’ve hit this too.

Though I never implemented it, back then I thought an internal-only Fly app (in the same org) to vend out secrets to other apps over 6pn should work just as good. As if, that Fly app was the org’s mono-secret-vault.

I’m just flying by here; but to be clear, have you registered the app with (at least)
fly create before trying to import the secrets?

(I just tried the most oversimplified test possible, creating a blank app and importing a secret from a file, and it did set the secret)

1 Like

Nope, since I’ve been using launch to start apps so far, I totally missed this command! That should work perfectly, thanks.

2 Likes

If it fits your workflow, fly launch also has the --no-deploy flag you can use. flyctl launch · Fly Docs