Azure / Azure/static-web-apps

Deployment fails with "No matching Static Web App was found or the api key was invalid" on newly created resource

Open
#1,732 2 comments 10 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Deployments via Azure/static-web-apps-deploy@v1 consistently fail with BadRequest: No matching Static Web App was found or the api key was invalid, even after deleting and recreating the Static Web App resource with a fresh deployment token.

**To Reproduce**

1. Created an Azure Static Web App (Free tier) linked to a GitHub repo via the
GitHub integration option.
2. Azure auto-generated a workflow file and set the deployment token as a GitHub
Actions secret.
3. Deployment fails with the error below.
4. Reset the deployment token in Azure Portal and updated the GitHub secret -- same error.
5. Deleted the SWA resource entirely, created a new one, used the newly generated
token -- same error.
6. Tried both with and without OIDC (github_id_token) -- without OIDC gives
BadRequest, with OIDC (using @actions/core@1.6.0) gives InternalServerError.

see deployment script frontend.yml in the attachment.

Error output

Without OIDC (token-only):

DeploymentId: afc9484c-3017-4108-921f-7e5871f667fe
Try to validate location at: '/github/workspace/./frontend'.
App Directory Location: './frontend' was found.
Try to validate location at: '/github/workspace/swa-db-connections'.
Looking for event info
The content server has rejected the request with: BadRequest
Reason: No matching Static Web App was found or the api key was invalid.

With OIDC (`@actions/core@1.6.0`):

The content server has rejected the request with: InternalServerError
Reason: An unexpected error has occurred. Please ensure your deployment token is properly set and try again later.

What I've tried
• Resetting the deployment token and updating the GitHub secret
• Deleting and recreating the SWA resource entirely
• Deploying with and without OIDC token
• Updating @actions/core from 1.6.0 to 1.10.1
• Confirming the app is on the Free tier with no known limitations
• Triggering new workflow runs (not reruns) to pick up updated secrets
• The Azure status page shows no ongoing incidents
• Validated the SWA token I used in the deployment script is the same as the token on the Azure portal

**Expected behavior**
Deployment should succeed with a valid deployment token from an active SWA resource.

**Environment**
• SWA Plan: Free
• Deploy action: Azure/static-web-apps-deploy@v1
• Runner: ubuntu-latest
• Framework: Vite + React (output to dist)

[frontend.yml](https://github.com/user-attachments/files/26367755/frontend.yml)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.