-
Notifications
You must be signed in to change notification settings - Fork 19
Gatsby DSG Build on Netlify fails due to function size #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey! The build logs should include details of what are the largest files in the zip. Can you share the logs? |
This is related to ticket https://netlify.zendesk.com/agent/tickets/84013 from an Enterprise customer in our helpdesk, where there are things like:
Thanks in advance for your help, @ascorbic ! |
Thanks, @fool. The file mentioned in the ticket ( |
OK, I've realised I have access to your logs so am able to diagnose some of it. You appear to have several 150MB(!) json files in there, which are static query results. If you load the current index page for the site, you will see in the network panel that this is being downloaded for every page. This kind of thing happens when you are making static queries in Gatsby that return extremely large results. Are there static queries that are returning every page in the data store? |
@ascorbic Thanks for the response. It appears we do have a static query which returns every page, yes. This particular build has multiple languages available, and in some cases is building a version of a page for each language we have. If my build output is accurate, we're building something like 15,000+ pages (hence the desire to use DSG). I suppose this would explain why the json files are so large! |
I'm having a similar issue on my site, where I'm seeing mp4 files being bundled in all of my function zip files, causing them all to exceed the maximum function size. Deploy log I ended up working around this by adding the following to my [functions]
included_files = ["!.cache/page-ssr/routes/static/*.mp4"] It seems like the entire |
@trevorblades Not the whole |
I just ran up against this issue again for another site. Functions had been bundled and uploaded without issue for a long time, and suddenly they started failing because the function size was >50 MB. I added a line that excludes However, this has me worried that as we continue adding pages and more content to the site, our functions will eventually become too large to upload, and there won't be any other globs that I can reasonably exclude to make them work again. At that point, we'd be stuck. Reducing the amount of static content (MDX files rendered statically) isn't an option. It seems odd that all of those statically rendered MDX pages would be needed for our SSR pages, but I don't know what files I should or shouldn't exclude from the function bundles. |
I ran into this issue for a Gatsby site that uses Contentful as a source. I fixed it by using a filter to reduce the function size by about 70% to fit under a 50 MB limit. Inside gatsby-config.js,
|
We are having the same issue: https://app.netlify.com/sites/aiid/deploys/62d1ab99dec9430009a8a6a9 This is the project: https://github.com/responsible-ai-collaborative/aiid Looks like bundling the |
I'm having a similar issue with my We implemented SSR on the careers section of our site and ran into the same error when we deployed it to Netlify: The
This fixed the size issue and seems to be working in our deploy preview, but I'm nervous about pushing it into production. I'm assuming the pages that aren't using SSR don't need to be in If that's the fix, could the plugin filter out files that don't export The site I'm referring to is named |
@AustinLeeGordon your fix should be fine. Yes, it's a good idea to try to filter them like that. I will open an issue. The trouble is that Gatsby doesn't provide that information as part of the build, so we'd need to extract it in |
@ascorbic Sounds great! Thank you for the quick response! |
What is the recourse for using Gatsby's useStaticQuery + DSG on Netlify? I have many components in Gatsby that need localized data fetching, hence the need for useStaticQuery. Since static queries can't take variables, they do fetch large data sets which appear to bloat the .cache directory and data.json files. I've already set the env var so my data.mdb gets hosted on a CDN but my Gatsby Cloud is building with DSG enabled just fine which pains me because I don't want that out as a solution to this problem. |
Those size problems mentioned here are better solved in I started gatsbyjs/gatsby#37713 for what improvement could be made there. Some improvements already did happen - the I did prepare 2 ideas to tackle |
Having to move from the dying Gatsby Cloud to Netlify followed all steps, but the build fails on Netlify with:
Note that all "defer" values are set to "false" in gatsby-node.js Is there a quick fix? (The Netlify support will perhaps get back in 4 days, unclear if they will fix it. Basically, right at the time Gatsby Cloud will shut down.) |
@Vacilando Same issue. One of my client websites has ~ 130k pages, of which only 16% is done as SSG. This works fine on Gatsby Cloud, but the DSG function on Netlify just doesn't work for them. Concerned as deadline is looming - only a month to go. Frontend team is currently trying to upgrade from v4 to v5 to see if that resolves some issues, but an alternative is perhaps to switch to SSR, but that largely negates the benefits of Gatsby over what we had previously. That's assuming that SSR doesn't fall foul of the same issue that plagues DSG |
This is so sad. After Gatsby Cloud was sold to Netlify, Netlify should have made 100% sure their parameters match those of Gatsby Cloud, so that the migrations are painless. Because like this many of us are hostages of the situation — Gatsby Cloud perishing, Netlify hosting not working out of the box, people like us having to make decisions about deep analysis or even redesign of the apps. Honestly, if I am forced to redesign I may as well do it in NextJS. |
@Antaris, did the rework to SSR solve the problem for you? |
Uh oh!
There was an error while loading. Please reload this page.
My gatsby build on netlify fails due to the size of the DSG/SSR functions which are created by netlify-plugin-gatsby. Error produced is
Request must be smaller than 69905067 bytes for the CreateFunction operation
.Additionally, during the 'onPostbuild' section of the build, I get the following message:
The function zip ../../../tmp/zisi-6212bb95da69157a8c04d77d/__ssr.zip size is 266 MB, which is larger than the maximum supported size of 52.4 MB.
I'm able to get my build to function locally but when I serve the site, the DSG pages (which get successfully built as specified in build output log) don't work and return 404's.
Build is running
@netlify/plugin-gatsby 2.0.2
&gatsby 4.5.3
.I've contacted Netlify support, and they suggested this is to do with the functions from this plugin and not Netlify itself - they're hitting AWS's size limitation.
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: