Azure / Azure/static-web-apps

Azure/static-web-apps-deploy@v1 deployment generates staticwebapp.config.json for Nuxt 3

Open
#1,305 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I have a Nuxt3 app that generates a bunch of routes for a static site.
When I run the autogenerated GitHub workflow file that uses the Azure/static-web-apps-deploy@v1 action I see all the successful Oryx generate logs only to see at the end:

```
├─ .output/server/functions/chunks/rollup/_virtual_head-static.mjs.map (111 B) (112 B gzip)
├─ .output/server/functions/index.mjs (405 B) (244 B gzip)
└─ .output/server/functions/package.json (1.56 kB) (595 B gzip)
Σ Total size: 4.58 MB (1.09 MB gzip)
[success] [nitro] You can preview this build using `npx @azure/static-web-apps-cli start .output/public --api-location .output/server`
Done in 341.00s.
Preparing output...

Copying files to destination directory '/bin/staticsites/c8049899-b37e-47ef-922f-5726520e1736-swa-oryx/app'...
Done in 19 sec(s).

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

Done in 424 sec(s).

---End of Oryx build logs---
Try to validate location at: '/bin/staticsites/c8049899-b37e-47ef-922f-5726520e1736-swa-oryx/app/.output/public'.
Finished building app with Oryx
Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
Encountered an issue while validating staticwebapp.config.json: The file size exceeds the limit of 20 KB.

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

To note:
`Encountered an issue while validating staticwebapp.config.json: The file size exceeds the limit of 20 KB`

The staticwebapp.config.json that is present in the app_location (which is /) is 464 Bytes and looks like this:

```
{
"routes": [
],

"navigationFallback": {
"rewrite": "/index.html",
},

"responseOverrides": {
"404": {
"rewrite": "/index.html",
"statusCode": 200
}
},

"globalHeaders": {
"Referrer-Policy": "strict-origin-when-cross-origin",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "SAMEORIGIN"
}
}
```

I tried the Oryx build locally, but that doesn't generate a staticwebapp.config.json, and I don't find any documentation that it would generate one. So I don't understand why it tells me I have a config file bigger than 20kb when it is just 464 Bytes.

**To Reproduce**
No clue

workflow yaml file:
```
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
steps:
- uses: actions/checkout@v3
with:
submodules: true
lfs: false

- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_SMOKE_0925AC503 }}
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: ".output/server" # Api source code path - optional
output_location: ".output/public" # Built app content directory - optional
###### 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: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_SMOKE_0925AC503 }}
action: "close"
```

Repo is sadly not public.

**Expected behavior**
A running static web app and a reasonable error message.

**Device info (if applicable):**
I've run the runner on a self-hosted runner and the GitHub runner.
I thought I'd be able to check the staticwebapp.config.json in the self-hosted runner, but the docker container was deleted too fast for me to search for it and copy it out.
The _work directory that was set in the runner config does only contain the one staticwebapp.config.json that i provided.

**Additional context**
We had the application successfully deployed to Vercel and AWS amplify.

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.