Internal Server Error when Deploying Static Web App without an API
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I'm attempting to deploy a branch from Github using Github Actions to Azure Static Web Apps without an API. We deploy separate and independent Azure Functions. We can deploy without issue from other branches and this particular branch is only 1 character different than the other branch that is deploying correctly.
The following exception is thrown when deploying
```
The content server has rejected the request with: InternalServerError
Reason: An unexpected error has occurred. Please try again later.
```
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Deploy from branch using Github Actions
2. Deployment fails
Workflow.yml
```
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
# More GitHub Actions for Azure: https://github.com/Azure/actions
# name: Build and deploy Node.js project to Azure Function App - XXXXX-Functions -
name: Build and deploy Node.js project to Azure Function App and SWA
on:
push:
branches:
- development
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- development
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: './api' # set this to the path to your web app project, defaults to the repository root
NODE_VERSION: '14.x' # set this to the node version to use (supports 8.x, 10.x, 12.x)
jobs:
# Static Web App
build_and_deploy_job_SWA:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy Job - SWA
env:
CI: false
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build And Deploy (Development)
if: github.event_name != 'pull_request' #development
id: builddeploydevelopment
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_XXXXX }}
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: '/' # App source code path
api_location: '' # Api source code path - optional - empty as we use standalone functions app
output_location: 'build' # Built app content directory - optional
app_build_command: npm run build:development
- name: Build And Deploy (Staging)
if: github.event_name == 'pull_request' && github.event.action != 'closed' #staging
id: builddeploystaging
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_XXXXX }}
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: '/' # App source code path
api_location: '' # Api source code path - optional - empty as we use standalone functions app
output_location: 'build' # Built app content directory - optional
app_build_command: npm run build:staging
###### End of Repository/Build Configurations ######
###### 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 - SWA
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_XXXXX }}
action: 'close'
build-and-deploy-AF:
name: 'Build and Deploy Job - Functions App'
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v2
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Resolve Project Dependencies Using Npm'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install
npm run build --if-present
npm run test --if-present
popd
- name: 'Run Azure Functions Action (Staging)'
if: github.event_name == 'pull_request' && github.event.action != 'closed' #staging
uses: Azure/functions-action@v1
id: fa-pr
with:
app-name: 'XXXXXXX-Functions-Production'
slot-name: 'Development-Staging' #staging
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_XXXXXXXXX }}
- name: 'Run Azure Functions Action (Development)'
if: github.event_name != 'pull_request' #development
uses: Azure/functions-action@v1
id: fa-push
with:
app-name: 'XXXXXX-Functions-Production'
slot-name: 'development' #development (initially and permanently named Production on Azure Portal)
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_XXXXXXXXXXX }}
```
staticwebapp.config.json
```
{
"navigationFallback": {
"rewrite": "/index.html"
},
"globalHeaders": {
"referrer-policy": "strict-origin-when-cross-origin"
}
}
```
**Expected behavior**
We are expecting for the application to deploy to the Static Web App. The Azure Function App deploys without issue.
**Screenshots**

Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.