An Azure service that provides streamlined full-stack web app development.
If out is built before the deployment action, deploy that directory directly with app_location: "out", skip_app_build: true, and an empty output_location, then test the URL shown specifically for the dev environment rather than the production hostname.
Correct the prebuilt-artifact deployment
In .github/workflows/azure-static-web-apps-*.yml, configure the upload step as follows:
- name: Deploy prebuilt site
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: out
api_location: ""
output_location: ""
skip_app_build: true
production_branch: main
For a prebuilt deployment, app_location is the directory containing the files to upload, while output_location must be empty. Microsoft also specifies that staticwebapp.config.json, when used, must be copied into that output directory.^1^
Do not combine either of these configurations:
app_location: "/"
output_location: "out"
skip_app_build: true
or:
app_location: "out"
output_location: "out"
With skip_app_build: true, Azure treats app_location itself as the build output location. In the normal build mode, by contrast, output_location is interpreted relative to app_location.^1^
Commit this workflow change and inspect GitHub repository → Actions → workflow run → Build and Deploy Job → Build And Deploy. The deployment log is the authoritative place to see which app directory was packaged.^2^
Open the correct dev URL
If main is configured as production_branch, a push from dev is deployed as a branch preview environment—not to the default production hostname. Its URL has a form similar to:
<DEFAULT_HOST_NAME>-dev.<LOCATION>.azurestaticapps.net
Open Azure portal → Static Web App → Environments → dev and use the URL displayed for that row. Branch environments have separate stable URLs containing the branch name.^3^
Also check that the workflow contains both:
on:
push:
branches:
- main
- dev
and:
production_branch: main
The production branch is served through the production hostname; other configured branches are served through preview hostnames. Custom domains do not work with preview environments.^4^
If dev is intended to be production, set:
production_branch: dev
Then a dev deployment targets the production environment and default hostname. Do not set deployment_environment unless a named preview environment is intentional; that setting explicitly directs deployments to a separate named environment.^5^
If the corrected environment URL still returns 404
Because /index.html itself returns 404, a client-side navigation fallback is not the primary fix. A fallback only addresses browser requests for routes that do not exist as deployed assets; it does not make an absent deployed /index.html appear.^6^
Run these checks next:
- In the deployment log, verify that the action identifies
outas the app directory and does not run a second Oryx frontend build. - Ensure
out/staticwebapp.config.jsonexists if configuration is required. - In Azure portal → Static Web App → Environments, verify that the hostname being tested belongs to the same
devenvironment updated by the latest workflow run. - Open Diagnose and solve problems for the Static Web App and review the diagnostic report.^2^
- If the corrected artifact configuration still produces a branded 404 for
/index.htmlon the exact environment URL, open an Azure support request and include the workflow run URL, deployment ID, environment name, hostname, and UTC request time. At that point the symptom is consistent with content not being attached to the environment despite a completed deployment, rather than an application route issue.
References
- Build configuration for Azure Static Web Apps (github-actions)
- Troubleshooting deployment and runtime errors
- Create branch preview environments in Azure Static Web Apps
- Preview environments in Azure Static Web Apps
- Create named preview environments in Azure Static Web Apps
- Azure Static Web Apps Frequently Asked Questions