Azure / Azure/static-web-apps

SWA Deployment Reports Success but API Endpoint Returns 404 (Inconsistent State)

Open
#1,681 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hello Azure Team,
I'm experiencing a persistent critical error with my Static Web App resource. Despite all indicators showing that the deployment was successful, my integrated API endpoint consistently returns a 404 error.
Resource Details:
* Static Web App Name: notfoundstaticweb (or orange-stone-062a5661e.2.azurestaticapps.net)
* GitHub Repository: [the link to your repository]
* GitHub Action Last Run ID (if you have one): [found in the Action page URL]
Issue Summary:
1. I have a standard project structure with the frontend in the root (/) and a Node.js Function API in the /api folder.
2. My GitHub Actions workflow file (.github/workflows/...yml) is configured with app_location: "/" and api_location: "api".
3. The GitHub Action execution completes successfully (✅), and the logs show that both the application and the API were found and successfully built.
4. However, when trying to access the API endpoint (/api/visitorcounter), I receive a 404 Not Found error.
Crucial Diagnostic Steps Already Taken:
* curl directly to the endpoint: A curl test directly to the API URL (https://[...].azurestaticapps.net/api/visitorcounter) proves that the function responded correctly at one point (returning "Hello, World!"), but failed consistently afterward, even after new deployments.
* curl to index.html: A curl test to the index.html file on the server shows that the contents of the frontend file are correct and up-to-date.
* Cache and Network: The issue was replicated on a completely different network and in a browser in incognito mode, proving that it is not a local cache issue. Conclusion: The evidence strongly points to an inconsistent state in the Static Web App service, where successful deployments aren't propagating correctly to the CDN edge servers, or the API gateway isn't registering correctly. The service appears to be stuck in a corrupted state.

The only solution that seems to work is to completely delete the Static Web App resource and recreate it from scratch.

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.