Azure / Azure/static-web-apps

Deployment token rejected with "BadRequest: No matching Static Web App was found" — reproducible via Portal, CLI, and official SWA CLI (resource otherwise healthy)

Open
#1,782 0 comments 0 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 to our Static Web App (`mrb-dashboard`) have been consistently failing with:

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

This happens **regardless of deployment method** — we've ruled out every client-side cause we could think of (see "What we've tried" below). The resource itself is healthy and reachable via ARM/CLI/Portal (it's live and serving traffic at its custom domain), so this looks like a backend/content-server-side issue specific to this resource, not a token or configuration problem on our end.

## Resource details

- Resource ID: `/subscriptions/fbfb874b-7c4c-4b16-8db4-8692b58ebf99/resourceGroups/mrb-dashboard-rg/providers/Microsoft.Web/staticSites/mrb-dashboard`
- Name: `mrb-dashboard`
- Default hostname: `agreeable-desert-0ed1f2510.7.azurestaticapps.net`
- Custom domain: `dashboards.mrbstorage.com` (live and serving the last successful deployment)
- Location: Central US
- SKU: Free
- A `DeploymentId` from one of the failed GitHub Actions runs: `50f33347-d8f1-4074-bb27-b49d5ea87fed`

## What we've tried (all failed with the exact same BadRequest)

1. Reset the deployment token via the Azure Portal ("Manage deployment token" → Reset), updated the corresponding GitHub Actions repository secret (`AZURE_STATIC_WEB_APPS_API_TOKEN_AGREEABLE_DESERT_0ED1F2510`), re-ran the workflow.
2. Deleted and recreated the GitHub Actions secret from scratch (in case of a copy/paste issue), same result.
3. Removed a stray OIDC (`github_id_token`) flow from the workflow that was triggering an unrelated `Unexpected input(s)` warning — this fixed the warning but not the underlying deploy failure.
4. Disconnected the GitHub source-control link at the resource level via Azure CLI:
```
az staticwebapp disconnect -n mrb-dashboard -g mrb-dashboard-rg
```
Confirmed via `az staticwebapp show` that `repositoryUrl`, `repositoryToken`, and `provider` are now `null`/`"None"`.
5. Reset the API key directly via CLI (bypassing the portal UI entirely):
```
az staticwebapp secrets reset-api-key -n mrb-dashboard -g mrb-dashboard-rg
az staticwebapp secrets list -n mrb-dashboard -g mrb-dashboard-rg --query "properties.apiKey" -o tsv
```
6. Used that freshly-generated token to deploy directly with the official SWA CLI (`@azure/static-web-apps-cli` v2.0.10), completely bypassing GitHub Actions:
```
swa deploy /tmp/swatest --deployment-token "$TOKEN" --env production
```
This also failed with the identical error:
```
✖ The content server has rejected the request with: BadRequest
✖ Reason: No matching Static Web App was found or the api key was invalid.
✖ Deployment failed with exit code 1
```

Since step 6 uses a token generated moments earlier via `az staticwebapp secrets reset-api-key`, and is deployed with Microsoft's own official CLI with no GitHub involvement at all, we believe this rules out any client-side token/secret/workflow issue and points to a desync between the ARM control plane and the deployment content server for this specific resource.

## Expected behavior

A deployment token generated via `az staticwebapp secrets reset-api-key` (or the Portal's "Reset token") should be accepted by the content server for the resource it was generated for.

## Steps to reproduce

Unknown on our end — this resource was deploying successfully via GitHub Actions until our most recent attempt (the workflow run with `DeploymentId: 50f33347-d8f1-4074-bb27-b49d5ea87fed`, first seen failing on 2026-07-29). No changes were made to the resource's region, SKU, or hosting plan around that time as far as we're aware. The site itself (`dashboards.mrbstorage.com`) is still live and serving the last successful deployment.

## Additional context

- This is a Free-tier resource, so we don't have a support plan to open a formal Azure support ticket — filing here per the guidance in the CLI error output and prior similar issues in this repo.
- We also tried the Portal's built-in **"Diagnose and solve problems"** tool on this resource. It hangs for a while and then fails with a generic `Sorry, an error occurred. Please refresh the page and try again.` — it's unable to complete a diagnostic pass on this resource at all, which seems consistent with something being broken in the backend service for this specific Static Web App rather than a client-side config issue.
- Happy to provide additional diagnostic output (further CLI output, HAR files, etc.) on request.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with `az staticwebapp secrets reset-api-key` followed by the official `swa deploy` command, then compare the resource state from `az staticwebapp show` with the deployment response. The issue is done when the regenerated token is accepted for `mrb-dashboard`, or when the backend cause and required remediation are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, github-actions
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.