Azure / Azure/static-web-apps

Failed to find a default file in the app artifacts folder. Valid default files: index.html,Index.html.

Open
#1,521 1 comment 2 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**

I'm receiving the following error: Failed to find a default file in the app artifacts folder (dist/kidztownwebapp.client). Valid default files: index.html,Index.html.

I'm trying to deploy an Angular 18 application with a .NET Core 8 backend, so my project is set up like this: I have a client app folder that holds the Angular application (kidztownwebapp.client) and an API folder for the backend (KidzTownWebApp.Server).

I noticed my dist folder actually pushes the index.html file to dist/kidztownwebapp.client/browser. I changed my angular.json outputPath to "dist/kidztownwebapp.client/browser" and updated my .yml foloder output_location to match it "dist/kidztownwebapp.client/browser" but I still get the same error.

I also tried leaving the output_location empty and putting skip_app_build: true and skip_api_build: true, but it still didn't work.

- staticwebapp.config.json file
{
"platform": {
"apiRuntime": "node:18"
}

}

YML File:
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
YML file:
jobs:
build_and_deploy_job:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'
###### check-latest: true ---will download latest, has performance issues
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ my secret here }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "kidztownwebapp.client/" # App source code path
api_location: "api" # Api source code path - optional
output_location: "dist/kidztownwebapp.client/browser" # Built app content directory - optional
#skip_api_build: true #AML remove if needed to be built through yml
#skip_app_build: true #AML remove if needed to be built through yml
###### End of Repository/Build Configurations ######

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ [REMOVED]}}
action: "close"

**Expected behavior**
This part of the build step should clear.

**Screenshots**
![Screenshot 2024-07-31 121239](https://github.com/user-attachments/assets/903ec392-7d64-4954-8536-f015087dc3b2)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing angular.json and the GitHub Actions workflow, especially app_location and output_location, then compare the generated dist/kidztownwebapp.client/browser contents with the deployment action's expected artifact path. Check staticwebapp.config.json and the workflow run output to isolate why index.html is not found; done means the build and deployment complete without the default-file error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, azure, github-actions, node.js
Domain
ci-cd, cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.