Unwanted zip files causing build failures

API ID 8ca2407a-06dd-4389-ad16-6a34628f0f32
https://d8gshop.netlify.app/

Build settings (Netlify App)
Base directory Not set
Build command npm run build
Publish directory public
Builds Active

Branches (Netlify App)

Production branch master
Branch deploys setup

log: Netlify App

I’m trying to deploy another Gatsby site for a client and I’m seeing errors I’ve never seen before. The following zip files are being created for some reason for features I’m not using.
The two files are __dsg.zip and /__ssr.zip which would seem to be Deferred Static Generation and
ServerSideRendering; again - features that I’m not using.
I understand these files are too large. The question is why/how they are being created at all.
This build works fine in my local environment but fails on Netlify.

line 463 ------
4:18:03 PM:   5. @netlify/plugin-gatsby (onPostBuild event)                 
4:18:03 PM: ────────────────────────────────────────────────────────────────
4:18:03 PM: ​
4:18:15 PM: The function zip ../../../tmp/zisi-621eb644e1c12a00081b817a/__dsg.zip size is 71.9 MB, which is larger than the maximum supported size of 52.4 MB.
4:18:15 PM: There are a few reasons this could happen, such as accidentally bundling a large dependency or adding lots of files to "included_files".
4:18:15 PM: Contains 302 files

<snip>

4:18:15 PM: The function zip ../../../tmp/zisi-621eb644e1c12a00081b817a/__ssr.zip size is 71.9 MB, which is larger than the maximum supported size of 52.4 MB.
4:18:15 PM: There are a few reasons this could happen, such as accidentally bundling a large dependency or adding lots of files to "included_files".
4:18:15 PM: Contains 302 files

Hey @witcradg

Looking at the @netlify/plugin-gatsby npm package you can disable this functionality if you are not using it. To quote the page:

If you are using the latest version of gatsby-plugin-netlify then this will be handled automatically, disabling functions if the site has no Gatsby Functions, or DSG/SSR pages. Otherwise, you can do this manually by setting the environment variable NETLIFY_SKIP_GATSBY_FUNCTIONS to true

1 Like

Perfect. This completely handled the problem I was having thank you very much @coelmay

2 Likes

So glad to hear your problem is solved, @witcradg!!! Thanks for the insights, @coelmay :rocket: :netliconfetti:

1 Like

I found later that gatsby-plugin-netlify BY ITSELF did not do it for me on another project. I added the environment variable and the problem went away. I did not try removing the plugin so I can’t say if you can fix this without the plugin.

1 Like

Following up on this. What if we are using SSR in Gatsby using this plugin. I’m getting the same error:

The function zip ../../../tmp/zisi-626cc96eb306fe00086237be/__dsg.zip size is 58.2 MB, which is larger than the maximum supported size of 52.4 MB.

The files included in the table below this message include mp4s (from statically-rendered blog posts) and other large files, seemingly unrelated to my SSR pages.

In addition, a massive DSG function zip is being created, when I don’t use any DSG in my app.

My deploy log: Netlify App

Hey there, @trevorblades :wave:

Thanks for reaching out about this. Looking at your build logs, it looks like you’ve gotten this working. Are you still encountering any obstacles? If you are, can you share the specific site this is impacting as well as any debugging steps you have taken since you last posted?

1 Like

I ended up working around this issue by adding the following to my netlify.toml:

[functions]
  included_files = ["!.cache/page-ssr/routes/static/*.mp4"]

It seems like the entire .cache directory is being bundled with each function causing them to bloat since there are large files like mp4s in there. Is the Gatsby cache being included on purpose? I’m using the Netlify Gatsby plugin (@netlify/plugin-gatsby)

Hi @trevorblades,

It does appear that the .cache directory is included on purpose:

We are having the same issue:

Is it really necessary to bundle the .cache folder?? I had the idea that it was only used at build time.

Yes, that is required.

Since your Gatsby Datababse is so huge:

site/gatsby-site/.cache/data/datastore/data.mdb

You can try this: