Azure / Azure/static-web-apps

Production deploy failing during content distribution

Open
#811 8 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Description:**

I have two GitHub Action pipelines set up - one for Pull Request, and one for Merge to Main. Both pipelines do a custom build: We use PNPM as a package manager, and build a [Astro](https://astro.build) website - then use `Azure/static-web-apps-deploy@v1` as the final step to do the 'upload' action. In the PR file, there is also a job to call the 'close' action.

In the PR file, everything works fine and deploys. When the PR is merged the 'close' action works fine, but the merge pipeline 'upload' fails after about 15 seconds with the following message:

```
Verbose logging enabled
Build timeout not specified, defaulting to 15 minutes
App Directory Location: 'dist/apps/hub' was found.
No Api directory specified. Azure Functions will not be created.
Looking for event info
Event info parsed from GitHub event json.
Skipping step to build /github/workspace/dist/apps/hub with Oryx
Didn't find Oryx manifest file under location: /bin/staticsites/ss-oryx/app-manifest/oryx-manifest.toml
Could not find staticwebapp.config.json file.
Determined default file to be: index.html
Either no Api directory was specified, or the specified directory was not found. Azure Functions will not be created.
Zipping App Artifacts
App Zip will be created from directory: /github/workspace/dist/apps/hub
Done Zipping App Artifacts
Uploading build artifacts.
Skipping function upload as functions are identical to last successful deployment.
Finished Upload. Polling on deployment.
Status: InProgress. Time: 0.2689137(s)
Status: Failed. Time: 15.5947[25](https://github.com/runs/6554379448?check_suite_focus=true#step:9:26)4(s)
Deployment Failed :(
Deployment Failure Reason: Failure during content distribution.

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
```

I have enabled `VERBOSE: true` in the environment variables, but there are no further logs.

We are using both GH and Azure Enterprise. The YAML files used are as follows, almost identical except for no `if` or `'close'` block in the merge file.

**ci-pr.yaml**
```yaml
name: Pull Request

on:
pull_request:
branches:
- '**'
types: [opened, reopened, synchronize, closed]

jobs:
pull_request:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
name: 'Deploy: Development'
runs-on: ubuntu-latest
environment: dev
strategy:
matrix:
node-version: [16.x]

steps:
# Checkout Code from Repo
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: 'Checkout'
run: git fetch --no-tags --prune --depth=5 origin main
- name: 'Setup: CI Environment (NodeJS: ${{ matrix.node-version }}, ubuntu-latest)'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
# Install Machine-Level Dependencies
- name: 'Setup: Machine Dependencies'
run: |
.github/scripts/env-clean minor
.github/scripts/env-setup
# Check for cached dependencies
- name: 'Setup: Cached Dependencies'
id: cache
uses: actions/cache@v2
with:
path: /home/runner/.local/share/pnpm/store/v3
key: modules-${{ hashFiles('pnpm-lock.yaml') }}
# Run NPM Install if no cached dependencies
- name: 'Setup: Install Dependencies'
run: pnpm install
- name: 'Run Build'
run: 'pnpm build hub'
- name: 'Build And Deploy'
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC }}
repo_token: ${{ secrets.GH_PAT }}
action: upload
app_location: 'dist/apps/hub'
output_location: ''
skip_app_build: true
env:
VERBOSE: true

close:
name: 'Close: Development'
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
environment: dev
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC }}
action: 'close'
env:
VERBOSE: true
```

**ci-merge.yaml**
```yaml
name: Deploy to Staging Environment

on:
pull_request:
branches:
- 'main'
types: [closed]

jobs:
pull_request:
name: 'Deploy: Development'
runs-on: ubuntu-latest
environment: dev
strategy:
matrix:
node-version: [16.x]

steps:
# Checkout Code from Repo
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: 'Checkout'
run: git fetch --no-tags --prune --depth=5 origin main
- name: 'Setup: CI Environment (NodeJS: ${{ matrix.node-version }}, ubuntu-latest)'
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
# Install Machine-Level Dependencies
- name: 'Setup: Machine Dependencies'
run: |
.github/scripts/env-clean minor
.github/scripts/env-setup
# Run NPM Install if no cached dependencies
- name: 'Setup: Install Dependencies'
run: pnpm install
- name: 'Run Build'
run: 'pnpm build hub'
- name: 'Build And Deploy'
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC }}
repo_token: ${{ secrets.GH_PAT }}
action: upload
app_location: 'dist/apps/hub'
output_location: ''
skip_app_build: true
env:
VERBOSE: true
```

**Expected Behaviour:**

That the **ci-merge.yaml** deploy job succeeds.

** Environment **

GitHub Action - `ubuntu-latest`
Azure Static Web App (Within Azure Enterprise, Standard hosting plan but **not** enabled with Enterprise Edge)
PNPM 7.1.0
Astro Static Site Builder

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.