Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

Encountered an issue while validating staticwebapp.config.json: The file size exceeds the limit of 20 KB. #1452

Open tonypoku opened 2 months ago

tonypoku commented 2 months ago

Describe the bug

Until this week, I have been using a CI/CD workflow to deploy my React application to Azure static web. I am now getting an error that says

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

There have been no changes to my workflow file other than tweaks I have made since the incident started happening in an attempt to resolve. The incident first started happening on Wednesday.

image

My last successful run was a month ago.

image

To Reproduce Steps to reproduce the behavior: Execute workflow to deploy React application to Azure Error occurs during Build and Deploy step, using Azure/static-web-apps-deploy@v1

The message is ---End of Oryx build logs--- Try to validate location at: '/bin/staticsites/8108862a-9300-4403-b23d-f3b8233fdc2b-swa-oryx/app/build'. 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.

Expected behavior Until recently, I was able to deploy using the exact same workflow. Below is what I was expecting to see...

---End of Oryx build logs--- Try to validate location at: '/bin/staticsites/6b02c9eb-32fe-457c-b449-ec3031a847b5-swa-oryx/app/build'. Finished building app with Oryx No Api directory specified. Azure Functions will not be created. Either no Api directory was specified, or the specified directory was not found. Azure Functions will not be created. Zipping App Artifacts Done Zipping App Artifacts Uploading build artifacts. Finished Upload. Polling on deployment. Status: InProgress. Time: 0.0614594(s) Status: InProgress. Time: 15.1233647(s) Status: Succeeded. Time: 30.186602(s) Deployment Complete :)

Screenshots Failure image

Success image

Device info (if applicable):

Additional context This is a private repo so I am not able to include a link, but I will be happy to get on a Teams call and share my screen. Thanks!

markuslewin commented 2 months ago

Do you have a staticwebapp.config.json file for the project?

I had the same problem, but managed to resolve it by adding a file staticwebapp.config.json containing an empty object in the root directory of the repo (my app_location):

{}

I think the file is supposed to be optional, though...

Crazzy-novus commented 2 months ago

@markuslewin

I also have the same Issue could you explain how to resolve in my case My error : Screenshot (174)

My repo:

Screenshot (175)

tonypoku commented 2 months ago

Do you have a staticwebapp.config.json file for the project?

I had the same problem, but managed to resolve it by adding a file staticwebapp.config.json containing an empty object in the root directory of the repo (my app_location):

{}

I think the file is supposed to be optional, though...

Sorry, it took me so long to get back to this issue. Thanks @markuslewin. This did the trick for me.