Since we use skip_app_build: true and is_static_export: true,
Azure SWA looks for static files directly in app_location.
Next.js static export outputs to 'out/' directory, so we point
app_location directly to '/out' where index.html exists.
Azure SWA recommends this parameter to gracefully handle missing
deployment tokens. When secrets are not configured, the workflow
will continue without deployment.
- Remove invalid 'skip_deploy_on_missing_secrets' parameter
- Use 'is_static_export: true' instead of IS_STATIC_EXPORT env var
- All parameters now match Azure static-web-apps-deploy@v1 action spec
When IS_STATIC_EXPORT=true, Azure SWA expects output_location to be
an empty string ('') to auto-detect Next.js static export files.
Azure will look for the app source in app_location='/' and auto-discover
the 'out' directory where Next.js static export outputs files by default.
Fixes: Cannot find default file in artifacts folder (/) error
When IS_STATIC_EXPORT=true, SWA needs to know where to find the
built static files. Next.js static export outputs to 'out/' directory.
Configuration:
- app_location: '/' (repository root - where source is)
- output_location: 'out' (where Next.js static export files are)
- IS_STATIC_EXPORT: true (skip Oryx build, use pre-built files)
- skip_app_build: true (we already built in npm run build step)
This tells SWA to look for index.html in the 'out' directory.
Per Microsoft official documentation:
https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-static-export
Key changes:
- Set IS_STATIC_EXPORT=true environment variable (required for static Next.js)
- Set output_location to 'out' (Next.js static export default)
- Set api_location to empty string (no API for static export)
- Keep skip_app_build=true (we build in previous step)
This is the official Azure recommended configuration for Next.js static sites.
BREAKING CHANGES:
- Switch to static export mode (output: 'export') per Azure SWA best practices
- Remove staticwebapp.config.json to avoid routes.json conflict
- Convert server-side layouts to client-side only (remove cookies() usage)
- Auth now handled entirely by client-side AuthGuard component
- Output directory changed from .next/standalone to 'out'
- Remove redirects from next.config (not supported in static export)
This aligns with Azure Static Web Apps' official recommendation for Next.js.
Server-side features (SSR, API routes, server actions) are not supported.
All authentication and routing is client-side via React components.
- Add standalone output mode in next.config.mjs
- Configure environment variables with .env.example
- Update staticwebapp.config.json with proper routing and fallback
- Optimize GitHub Actions workflow with npm cache and env vars
- Set output_location to .next/standalone for SWA deployment
- Preserve all business logic in API client, auth, and components