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
331 stars 57 forks source link

staticwebapp.config.json: 20KB limit during build & deploy vs 100KB documentation #661

Open ghost opened 2 years ago

ghost commented 2 years ago

Based on https://github.com/login?return_to=/staticwebdev/vanilla-basic/generate, I encounter the following issue during the Build and Deploy step of the GitHub Action, once I have added all my required config to staticwebapp.config.json:

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.

My file is 33KB, or 25KB when minified, but the documentation states that the max file size is 100KB: https://docs.microsoft.com/en-us/azure/static-web-apps/configuration#restrictions

Perhaps Azure/static-web-apps-deploy@v1 needs updating to up the limit to 100KB as per the documentation?

sirichards commented 2 years ago

Getting the same issue!

mkarmark commented 2 years ago

Apologies for the confusion, the error message is the source of truth. We are working to update the docs to be in sync with that message.

simonaco commented 2 years ago

@mrfrankbell @sirichards thanks for reporting this issue. can you help us understand more about your use case, what types of settings do you include in your config file?

ghost commented 2 years ago

In my case it was converting a dynamic site with about 140 pdf articles to a static site, whilst retaining the slugified URLs (routes). Apart from the routes I just have a custom 404 page configured and that's it.

I got under the limit by minimizing the file and folder lengths (e.g. 2021 to 21, abbreviations in file names etc) and then minifying the JSON config file, but I did still have to remove about 10 links for it to fall under 20kb unfortunately.

A 50-100kb limit seems more reasonable, but not sure about any technical constraints.


From: Simona Cotin @.> Sent: Monday, December 20, 2021 2:32:15 PM To: Azure/static-web-apps @.> Cc: Frank Bell @.>; Mention @.> Subject: Re: [Azure/static-web-apps] staticwebapp.config.json: 20KB limit during build & deploy vs 100KB documentation (Issue #661)

@mrfrankbellhttps://github.com/mrfrankbell @sirichardshttps://github.com/sirichards thanks for reporting this issue. can you help us understand more about your use case, what types of settings do you include in your config file?

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/static-web-apps/issues/661#issuecomment-997976700, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APNQKPEFLZ3VTDGYUN7XRKLUR4467ANCNFSM5KDHUCBA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website.

miwebst commented 2 years ago

Hey @mrfrankbell,

Would slug support solve your use case and reduce the number of routes that you need? For example if you had the ability to do:

route: "/pdfs/{folder}/{year}", rewrite: "newpdfs/{folder}/subfolder/{year}"

Would something like that work here?

ghost commented 2 years ago

Not in my case, as there are different articles, by different authors. I think the degree of variability would always require a number of different routes.

An example:

Route /section/author-name/2021/06/title-of-article which I am currently mapping to /s/21/AN-Title-of-Article.pdf.


From: miwebst @.> Sent: Monday, December 20, 2021 3:00:21 PM To: Azure/static-web-apps @.> Cc: Frank Bell @.>; Mention @.> Subject: Re: [Azure/static-web-apps] staticwebapp.config.json: 20KB limit during build & deploy vs 100KB documentation (Issue #661)

Hey @mrfrankbellhttps://github.com/mrfrankbell,

Would slug support solve your use case and reduce the number of routes that you need? For example if you had the ability to do:

route: "/pdfs/{folder}/{year}", rewrite: "newpdfs/{folder}/subfolder/{year}"

Would something like that work here?

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/static-web-apps/issues/661#issuecomment-997999697, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APNQKPBZJQMCK4M5EPZYPRLUR5AILANCNFSM5KDHUCBA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website.

SteveDrakey commented 2 years ago

Due to this issue 528

We have hit this limit, we have to use routes rather than navigationFallbacks to allow users to navigate directly to pages in our site.

Maybe increase the size until we have navigationFallback improvements?

acgiraudon commented 2 years ago

Up ! Same here ! We have a lot of redirects to handle (about 2500 redirects). The file size up to 650kb approximatively => we are far from the 20kb. We are using Gatsby and it seems to be the only SEO friendly solution but we are stuck.

hxlnt commented 1 year ago

It looks like the documentation has been updated to reflect the 20KB limit. However, I am now seeing that the limit has been restricted even further to 10KB...?

Build and Deploy Job failed 4 minutes ago in 1m 33s Encountered an issue while validating routes.json: The file size exceeds the limit of 10 KB.

pascalwengerter commented 1 year ago

@microsoftopensource could we get some feedback here? I'm in the process of migrating a very old system with a lot of redirects and have now run into this issue, with no obvious "official way" of resolving it

jwhazel commented 1 year ago

Watching this as well. We recently migrated the first of many sites to SWA and have found our file is at 19.9kb minified. That's 114 redirects for us with no room to grow. A fraction of what our other sites will have.

I can certainly understand if this were a limitation of the Free tier. But seems like Standard tier ($) should be capable of a bit more? If 20kb really is the max, we'll have to find new hosting.