Static-web-apps: The number of files in the app content folder exceeds the limit of 4000.

Created on 27 Aug 2020  Â·  28Comments  Â·  Source: Azure/static-web-apps

Trying to use a few dependencies in the function app prevents github actions from uploading to azure.

Error message:
---End of Oryx build logs---
Function Runtime Information. OS: Linux, Functions Runtime: v3, Node version: 12.X
Finished building function app with Oryx
Zipping App Artifacts
Done Zipping App Artifacts
Zipping Api Artifacts
Done Zipping Api Artifacts
The content server has rejected the request with: BadRequest
Reason: The number of files in the app content folder exceeds the limit of 4000.

Reproduce:

  1. Follow https://docs.microsoft.com/en-us/azure/static-web-apps/add-api
  2. Add dependencies to package.json
    "dependencies": { "google-auth-library": "6.0.5", "azure-storage": "2.10.3", "oauth-1.0a": "2.2.6", "request-promise": "4.2.6", "node-fetch": "2.6.0" },

Sample repository: https://github.com/thllbrg/azure-static-sample

Any workaround?

enhancement

Most helpful comment

This will change :) We are working on improvements to the service so this will no longer be a problem.

All 28 comments

Hi @thllbrg, this looks like a bug on our side. The root of the bug has to deal with how we are installing dependencies.

For a workaround, if you move your index.html and style.css into a folder called app and then change your workflow's app_location to be app then this should work.

In the meantime we will investigate what needs to be done to fix this issue!

Thanks, changing app_location work fine.

@miwebst Nuxt.js Static Build function has an integrated crawler, which will generate an index.html for your route + payload.js to mock asyncData for SEO purposes. This'll generate about 2-4 files / page.

If you've made a blog with a lot of pages, this'll force you to disable the crawler & fetch the data from your API -- this'll hurt SEO & UX.

I'd recommend setting the file limit to about 15k-25k files for now.

Do you think you can bump the limits?

Our app includes a very large third-party dependency (esri ArcGIS API for JavaScript, which is ~19k files) that results in our build output being 20k-21k files. The current file count limitation will prevent us from using Azure Static Web Apps.

Our app includes a very large third-party dependency (esri ArcGIS API for JavaScript, which is ~19k files) that results in our build output being 20k-21k files. The current file count limitation will prevent us from using Azure Static Web Apps.

You could lazy load the dependencies via the ArcGIS lazy load lib: https://developers.arcgis.com/javascript/latest/guide/esri-loader/

However, if you must implement the module in your box itself, you might be able to bundle them all in 1 Javascript file, or perhaps import only the one's you need. I'm not sure how that works for ArcGIS, but most of the time with external libs, I've been able to modularly inject dependencies.

Good luck.

I have a similar problem. My static web site has more than 4000 images and deploying my site via github actions leads to a Bad Request "Reason: The number of files in the app content folder exceeds the limit of 4000."
Will this be changed in the near future? Do I have to look for an alternative to Azure Static Web Apps? Or will the number of file limitation be removed?

This will change :) We are working on improvements to the service so this will no longer be a problem.

Our app includes a very large third-party dependency (esri ArcGIS API for JavaScript, which is ~19k files) that results in our build output being 20k-21k files. The current file count limitation will prevent us from using Azure Static Web Apps.

You could lazy load the dependencies via the ArcGIS lazy load lib: https://developers.arcgis.com/javascript/latest/guide/esri-loader/

However, if you must implement the module in your box itself, you might be able to bundle them all in 1 Javascript file, or perhaps import only the one's you need. I'm not sure how that works for ArcGIS, but most of the time with external libs, I've been able to modularly inject dependencies.

Good luck.

@LoopsGod, I really appreciate you taking the time to investigate my specific issue! That is kind of you, and I thank you for doing so! 😀

FWIW, we do currently use esri-loader. It's job is to help the web browser lazy-load the assets from the server. However, we have to get the assets on the server to host them in the first place, and there happens to be way more than 4k files to deploy for server hosting. Sadly, I don't think there's a viable way with the complexity of esri's build system to get a custom build that sufficiently reduces the number of files of various types given our use cases.

Thanks for offering some thoughts and ideas!

This will change :) We are working on improvements to the service so this will no longer be a problem.

Awesome news, @miwebst! Thank you so much! 😀

Is there a timeline when this file limit will be lifted?

@miwebst, bump, any chance you can get us a rough timeline when this might be resolved?

Running into the same issue as @roarwrecker.

We are hoping to have this fixed in roughly the next month, we have hit some unexpected delays on this so we appreciate your patience!

Thanks!

And as far as I can tell, there is no known workaround at the moment, right?

Hi @miwebst is there any update on the timeline?

Same issue here ! when using like 5k posts, tried with 200 posts and then everything works fine

image

Hi @miwebst per your advice I tried moving our Nuxt application to an "app" subfolder with updated app_location in the workflow, but still running into this "limit of 4000" error. Do you have any advice on how to use the workaround for a Nuxt app? Thank you

Hey @pioneerworksadmin , that guidance was because the workflow was previously misconfigured and uploaded unnecessary files. Does your Nuxt app have more than 4k files?

For everyone else on the thread, we are hoping to adjust this limit in the next 2 weeks.

Ah, thank you @miwebst for the clarification and update! Our Nuxt website has 5-10k pages. Do you have a sense of what the new file limit will be? Trying to determine if we can make this project scalable as a static web app.

We are actively determining that new limit as we are finishing up some architectural improvements that will let us improve this limit. Out of curiosity, are those 5-10k pages generated on each build or produced based on some CMS content? Would love to understand more about how these pages are managed.

Yes, the latter – the pages are generated from our Sanity.io CMS on "nuxt generate" per this example. Happy to provide any info that can help! In our case, we are hoping to deploy our arts journal as an Azure static web app.

Hi @miwebst sorry to rush you, do you know if this limit will be lifted in the next few days? We are launching our site on May 5 and need to decide if we will deploy it static or as regular Web App. Thank you!

This has been bumped to10k files. Hopefully this unblocks your deployments. This limit will increase over time as we continue to make improvements to our platform!

Awesome! Thank you!

Hi, I have a nextjs app without azure function. Oryx is able to successfully build 5k pages.
I'm getting error that it exceeds 10k limit.
The content server has rejected the request with: BadRequest Reason: The number of files in the app content folder exceeds the limit of 10000.

Is there any workaround for this?

Hey @kkankala, at this time there is no workaround. This limit will continue to be increased over time, just to confirm you are looking for the ability to upload 15k total files?

yes, that will work for now. Thank you @miwebst

Hi @miwebst, do you have any timeline when the limit will be increased to 15k?

We are working on the change now, should be available in a week or two.

Was this page helpful?
0 / 5 - 0 ratings