# \`flyctl secrets import\` before first deployment

**URL:** <https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758>\
**Category:** General\
**Created:** [June 23, 2022, 10:45pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758 "2022-06-23T22:45:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gforrest](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gforrest/32/40727_2.png) [@gforrest](https://community.fly.io/u/gforrest)\
**Post date:** [June 23, 2022, 10:45pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758/1 "2022-06-23T22:45:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ignoramous](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@ignoramous](https://community.fly.io/u/ignoramous)\
**Post date:** [June 24, 2022, 4:44pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758/2 "2022-06-24T16:44:39Z")

</div>

I’ve hit this too.

> [@gforrest](#):
>
> 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.

Though I never implemented it, back then I thought an [internal-only Fly app](https://community.fly.io/t/long-running-background-tasks/1153/2) (in the same org) to vend out secrets to other apps over [`6pn`](https://community.fly.io/t/fly-io-newbie-making-internal-requests-between-apps/5307/3) should work just as good. As if, that Fly app was the org’s mono-secret-vault.

---

<div class="post-metadata">

**Author:** ![catflydotio](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/catflydotio/32/14559_2.png) [@catflydotio](https://community.fly.io/u/catflydotio)\
**Post date:** [June 24, 2022, 5:16pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758/3 "2022-06-24T17:16:53Z")

</div>

I’m just flying by here; but to be clear, have you registered the app with (at least)  
[fly create](https://fly.io/docs/flyctl/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)

---

<div class="post-metadata">

**Author:** ![gforrest](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gforrest/32/40727_2.png) [@gforrest](https://community.fly.io/u/gforrest)\
**Post date:** [June 24, 2022, 6:47pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758/4 "2022-06-24T18:47:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![catflydotio](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/catflydotio/32/14559_2.png) [@catflydotio](https://community.fly.io/u/catflydotio)\
**Post date:** [June 24, 2022, 6:50pm UTC](https://community.fly.io/t/flyctl-secrets-import-before-first-deployment/5758/5 "2022-06-24T18:50:37Z")

</div>

If it fits your workflow, `fly launch` also has the `--no-deploy` flag you can use. [flyctl launch · Fly Docs](https://fly.io/docs/flyctl/launch/)
