Azure / Azure/static-web-apps

Azure Static Web Apps deployment fails to find index.html in <output_location>/browser for Angular app

Open
#1,645 2 comments 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

## Bug report

Aplicattion Name:
icy-pebble-06d30790f

**Description**
I am trying to deploy an Angular application to Azure Static Web Apps using GitHub Actions. The deployment fails with the error: `Failed to find a default file in the app artifacts folder (dist/back-tursd/browser). Valid default files: index.html,Index.html.`

The build process creates the following structure in the dist/back-tursd directory: browser/ (containing index.html and other client-side assets) and server/.

My Angular application's build process outputs the `index.html` file to the `dist/back-tursd/browser` directory. I have configured the `output_location` property in my GitHub Actions workflow to `"dist/back-tursd/browser"`.

Interestingly, the Oryx build logs indicate that it is validating the location `/bin/staticsites/.../app/dist/back-tursd/browser/`, which seems correct, but the deployment still fails to find the default file.

**Workflow YAML:**
```yaml
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master

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
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: '18' # o la versión que uses

- name: Install Angular CLI globally
run: npm install -g @angular/cli

- name: Install dependencies
run: npm install

- name: Build Angular App
run: ng build

- name: Deploy to Azure Static Web Apps
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_ICY_PEBBLE_06D30790F }}
action: "upload"
app_location: "/"
api_location: ""
output_location: "dist/back-tursd/browser"
github_id_token: ${{ steps.idtoken.outputs.result }}
###### 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:
action: "close"

Log output in Azure

2025-05-09T04:07:17.9795661Z ##[group]Run Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ***
action: upload
app_location: /
output_location: dist/back-tursd/browser

/usr/bin/docker run --name f1c1442ea5c58d5c874cd4958c496216f04a7c_920cda --label f1c144 --workdir /github/workspace --rm -e "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN" -e "INPUT_ACTION" -e "INPUT_APP_LOCATION" -e "INPUT_API_LOCATION" -e "INPUT_OUTPUT_LOCATION" -e "INPUT_GITHUB_ID_TOKEN" -e "INPUT_API_BUILD_COMMAND" -e "INPUT_APP_ARTIFACT_LOCATION" -e "INPUT_APP_BUILD_COMMAND" -e "INPUT_REPO_TOKEN" -e "INPUT_ROUTES_LOCATION" -e "INPUT_SKIP_APP_BUILD" -e "INPUT_CONFIG_FILE_LOCATION" -e "INPUT_SKIP_API_BUILD" -e "INPUT_PRODUCTION_BRANCH" -e "INPUT_DEPLOYMENT_ENVIRONMENT" -e "INPUT_IS_STATIC_EXPORT" -e "INPUT_DATA_API_LOCATION" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/back-tursd/back-tursd":"/github/workspace" f1c144:2ea5c58d5c874cd4958c496216f04a7c
DeploymentId: 983a5915-0e6e-48ef-9c14-6a07f51c031a

Try to validate location at: '/github/workspace'.
App Directory Location: '/' was found.
Try to validate location at: '/github/workspace/swa-db-connections'.
Looking for event info
Starting to build app with Oryx
Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
---Oryx build logs---

Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20241003.1, Commit: d5352431d933306ccee1be9b5d822c73bf723e9e, ReleaseTagName: 20241003.1

Build Operation ID: 605f542cff626f6d
OS Type : bullseye
Image Type : githubactions

Detecting platforms...
Detected following platforms:
nodejs: 18.20.8
php: 8.0.30
Version '18.20.8' of platform 'nodejs' is not installed. Generating script to install it...
Version '8.0.30' of platform 'php' is not installed. Generating script to install it...
Detected the following frameworks: Angular,Typescript,Express

Source directory : /github/workspace
Destination directory: /bin/staticsites/983a5915-0e6e-48ef-9c14-6a07f51c031a-swa-oryx/app

Downloading and extracting 'nodejs' version '18.20.8' to '/tmp/oryx/platforms/nodejs/18.20.8'...
Detected image debian flavor: bullseye.
Downloaded in 0 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: nodejs...
Done in 1 sec(s).

Downloading and extracting 'php' version '8.0.30' to '/tmp/oryx/platforms/php/8.0.30'...
Detected image debian flavor: bullseye.
Downloaded in 0 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: php...
Done in 1 sec(s).

Downloading and extracting 'php-composer' version '2.6.2' to '/tmp/oryx/platforms/php-composer/2.6.2'...
Detected image debian flavor: bullseye.
Downloaded in 0 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: php-composer...
Done in 0 sec(s).

Removing existing manifest file
Creating directory for command manifest file if it does not exist
Creating a manifest file...
Node Build Command Manifest file created.

Using Node version:
v18.20.8

Using Npm version:
10.8.2

Running 'npm install'...

up to date, audited 952 packages in 2s

160 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

Running 'npm run build'...

> back-tursd@0.0.0 build
> ng build

❯ Building...
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
Error al cargar los horarios: gu {
headers: e {
headers: undefined,
normalizedNames: Map(0) {},
lazyInit: [Function (anonymous)],
lazyUpdate: null
},
status: 404,
statusText: 'Not Found',
url: 'https://tursd-grhzehh6hta4e9en.eastus-01.azurewebsites.net/api/v1/horarios-atencion',
ok: false,
type: undefined,
name: 'HttpErrorResponse',
message: 'Http failure response for https://tursd-grhzehh6hta4e9en.eastus-01.azurewebsites.net/api/v1/horarios-atencion: 404 Not Found',
error: '\n' +
'\n' +
'\n' +
'\n' +
'Error\n' +
'\n' +
'\n' +
'

Cannot GET /api/v1/horarios-atencion
\n' +
'\n' +
'\n'
}
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.
✔ Building...
Browser bundles
Initial chunk files | Names | Raw size | Estimated transfer size
main-675EUF4D.js | main | 382.63 kB | 86.54 kB
styles-EMK7ME36.css | styles | 226.84 kB | 22.93 kB
polyfills-FFHMD2TL.js | polyfills | 34.52 kB | 11.28 kB

| Initial total | 643.99 kB | 120.75 kB

Server bundles
Initial chunk files | Names | Raw size
main.server.mjs | main.server | 852.53 kB |
server.mjs | server | 845.38 kB |
polyfills.server.mjs | polyfills.server | 267.76 kB |
chunk-X2SEQXRR.mjs | - | 2.41 kB |
chunk-GFUZYSQG.mjs | - | 1.24 kB |

Lazy chunk files | Names | Raw size
chunk-EJSJJTUO.mjs | xhr2 | 12.14 kB |
chunk-TNO4MGIL.mjs | xhr2 | 12.07 kB |

Prerendered 10 static routes.
Application bundle generation complete. [28.008 seconds]

▲ [WARNING] Deprecation [plugin angular-sass]

src/styles.scss:2:8:
2 │ @import 'bootstrap/scss/bootstrap';
╵ ^

Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.

More info and automated migrator: https://sass-lang.com/d/import

The plugin "angular-sass" was triggered by this import

angular:styles/global:styles:1:8:
1 │ @import 'src/styles.scss';
╵ ~~~~~~~~~~~~~~~~~

▲ [WARNING] bundle initial exceeded maximum budget. Budget 500.00 kB was not met by 143.99 kB with a total of 643.99 kB.

▲ [WARNING] 4 rules skipped due to selector errors:
.form-floating>~label -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group>+.btn -> Did not expect successive traversals.
.btn-group-vertical>+.btn -> Did not expect successive traversals.

Output location: /github/workspace/dist/back-tursd

Preparing output...

Copying files to destination directory '/bin/staticsites/983a5915-0e6e-48ef-9c14-6a07f51c031a-swa-oryx/app'...
Done in 4 sec(s).

Removing existing manifest file
Creating a manifest file...
Manifest file created.
Copying .ostype to manifest output directory.

Done in 37 sec(s).

---End of Oryx build logs---
Try to validate location at: '/bin/staticsites/983a5915-0e6e-48ef-9c14-6a07f51c031a-swa-oryx/app/dist/back-tursd/browser'.
Finished building app with Oryx
Failed to find a default file in the app artifacts folder (dist/back-tursd/browser). 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.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Exiting

Additional context

This is an Angular application.
I have already tried recreating the Azure Static Web App and updating the API Key.
I have reviewed issues #1576 and #1591 in this repository, and the solutions suggested there did not resolve my issue.

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.