Azure Static Web Apps - Failed to find a default file in the app artifacts folder. Valid default files: index.html,Index.html.
For a pet project I'm working on, I created a new Angular application using Angular 19. I used the same Github Actions setup I was using for my other projects. However, this time, the build failed with the following error message:
Failed to find a default file in the app artifacts folder (dist/treasurehunt). Valid default files: index.html,Index.html.
If your application contains purely static content, please verify that the variable 'app_location' in your workflow file points to the root of your application.
If your application requires build steps, please validate that a default file exists in the build output directory.
Here is the GitHub Actions file that was used:
Important to notice here are the following settings:
- app_location: This is the location where the Azure Static Web App build task looks for the source code
- output_location: This is the location where the Azure Static Web App looks for the final application. This should match with your configuration in the Angular.json file (check the outputPath setting):
As I mentioned in the intro, this is the default setup I've been using for a while and that always worked before. Until now...
What has changed?
The question now becomes: 'What has changed?' There should be something different that explains this issue…
After comparing different projects, I noticed that this was the first project that was using Angular 19 whereas previous applications were using Angular 17 or before. Aha!
Turns out that starting from Angular 18, the Angular team has updated the Angular CLI design to always output publicly accessible files in browser directory and the ssr files in server directory and other files such as statistics and licenses information in the root output path.
This means that the final application code (including the missing index.html
) file could be found in the dist\treasurehunt\browser
folder instead of the dist\treasurehunt\
folder as before.
Fixing this issue was simple, I updated the output_location
in the GitHub Actions file to take this change into account: