Failed to fetch platform version: Could not find App

I’m having strange errors trying to deploy a remix app. I can deploy the staging version of the app, but not the production version. I get an error like so:

Run superfly/flyctl-actions@1.3
  with:
    args: deploy --remote-only --build-arg COMMIT_SHA=485701b21a47fb55ca1d5372a9de363bf349fb74
  env:
    FLY_API_TOKEN: ***
/usr/bin/docker run --name bedb408083332fa91461699b581539b5e2976_dc0118 --label 5bedb4 --workdir /github/workspace --rm -e "FLY_API_TOKEN" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/crescendo/crescendo":"/github/workspace" 5bedb4:08083332fa91461699b581539b5e2976 deploy --remote-only --build-arg COMMIT_SHA=485701b21a47fb55ca1d5372a9de363bf349fb74
==> Verifying app config
--> Verified app config
Validating /github/workspace/fly.toml
WARNING: Failed to fetch platform version: Could not find App "crescendo-4e32"
✓ Configuration is valid
Error: Could not find App "crescendo-4e32"

I’ve got two apps: crescendo-4e32 (which is the prod version that is failing) and crescendo-4e32-staging, which is succeeding. I thought the issue might be due to an API token thing in Github, but if that’s the case, I’m not sure how to tell. My github deploy steps are as follows:

  deploy-staging:
    name: 🚀 Deploy Staging
    runs-on: ubuntu-latest
    environment: staging
    needs: [lint, typecheck, vitest]
    #    needs: [lint, typecheck, vitest, playwright]
    # only build/deploy main branch on pushes
    if:
      ${{ github.ref == 'refs/heads/dev' && github.event_name == 'push' }}

    steps:
      - name: ⬇️ Checkout repo
        uses: actions/checkout@v3

      - name: 👀 Read app name
        uses: SebRollen/toml-action@v1.0.2
        id: app_name
        with:
          file: 'fly.toml'
          field: 'app'

      - name: 🚀 Deploy
        uses: superfly/flyctl-actions@1.3
        with:
          args:
            'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }} --app
            ${{ steps.app_name.outputs.value }}-staging'
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

  deploy-production:
    name: 🚀 Deploy Production
    runs-on: ubuntu-latest
    environment: production
    needs: [lint, typecheck, vitest]
    #    needs: [lint, typecheck, vitest, playwright]
    # only build/deploy main branch on pushes
    if:
      ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}

    steps:
      - name: ⬇️ Checkout repo
        uses: actions/checkout@v3

      - name: 👀 Read app name
        uses: SebRollen/toml-action@v1.0.2
        id: app_name
        with:
          file: 'fly.toml'
          field: 'app'

      - name: 🚀 Deploy
        uses: superfly/flyctl-actions@1.3
        with:
          args: 'deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}'
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Hi @crescendo!

The “Could not find App” message can indeed mean that your token isn’t authorized to work on the app. (If a token isn’t authorized for an app, the API will claim that the app doesn’t exist.)

Just to check: how did you create your API token(s)? If you are by chance using deploy tokens, have you made sure to create separate tokens for each app?

Thanks for the reply! I was able to fix the problem by modifying my github action environments so that the FLY_API_TOKEN secret had a different name in staging and production. This made it easier to avoid one token clobbering another and made it more obvious when a token was not getting set. (this is the same person as Crescendo btw—didn’t realize I was replying from a different login)

2 Likes

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