Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy static app #1591

Open
karthikeyanpkks opened this issue Dec 10, 2024 · 2 comments
Open

Unable to deploy static app #1591

karthikeyanpkks opened this issue Dec 10, 2024 · 2 comments

Comments

@karthikeyanpkks
Copy link

karthikeyanpkks commented Dec 10, 2024

The content server has rejected the request with: BadRequest
Reason: No matching Static Web App was found or the api key was invalid.

i have updated the latest deployment token even though the above error on github action

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
Image

@DaleL-SilannaIT
Copy link

DaleL-SilannaIT commented Dec 17, 2024

I had the same issue.

Solution

You need to find this secret in your GitHub repo and set the value to your deployment token from your Static Web App.

How to get your deployment token

  1. Navigate to your Static Web App in Azure
  2. Select the Overview tab
  3. In the top ribbon, select the Manage deployment token tab and copy your token.
Image

How to set a secret value in GitHub Actions

  1. Navigate to your GitHub Repo on GitHub's website and log in with an owner account
  2. Select Settings in the ribbon at the top of the screen
Image 3. Under the `Secrets and variables` dropdown, select **Actions** Image 4. You can then add/edit the names and values of secrets that are exposed to GitHub Actions at runtime. Image

How to use a secret in GitHub Actions

  1. In your .github/workflows/azure-static-web-apps-XXXX.yml file you need to specify the secret name and environment variable under the Build and Deploy Job as well as the Close Pull Request Job
jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
          lfs: false
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_XXX}}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: "upload"
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: "/" # App source code path
          api_location: "api" # Api source code path - optional
          output_location: "build" # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

Deploy

Now make a commit to your repo and GitHub actions should deploy it to your Static Web App via the deployment token.

@Endres-G
Copy link

if i already make this, and still not working, what can i do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants