It’s saying that one of my functions is > 50 Mb, however the grand total of the files is < 1 Mb, and the dependencies (unzipped!) are < 10 Mb.
I’ve seen elsewhere on the forum that the dependencies are built platform-specific, but since the build fails I can’t download the built files and pull it apart to see what is happening.
Can anyone here give me the next steps for troubleshooting this?
Lastly, I’m getting ~67 notifications by email for each failed build… Please fix
Could you give that workflow a try and let us know what you find?
Re: zillions of emails, that’s quite odd - our system doesn’t show sending that many. Mind fishing me out the full headers of a couple of them (a couple of identical ones, I mean), and sending via DM to me?
Yes, I saw that document and unfortunately, I don’t see any dev dependencies that are being mistakenly included.
I think it’s due to a single depency, “chartjs-node-canvas”, which is including both chartjs and a canvas-for-node implementation, neither of which are lightweight.
When I build locally, it comes to < ~24Mb. I tried building using the build-image instructions here but I could get the build to proceed properly.
@fool I’ve figured out that one of my dependencies includes ~20Mb (unzipped) of documentation, and when I delete that locally and deploy via CLI, I don’t get any errors.
So, now I’m trying to avoid bundling it.
I’ve tried :
excluding it via included_files, and that didn’t work:
included_files = ["!src/api/GenerateSendReport/node_modules/chart.js/dist/docs/*","!node_modules/chart.js/dist/docs/*"]
// Above didn't seem to work, that folder is still bundled into the function when building locally and via Netlify's deployments
adding a command to delete that subfolder from node_modules before bundling, while it seems to delete, it doesn’t seem to do so in a way that prevents it from being bundled: build: "rm -rf ./node_modules/chart.js/dist/docs && rest-of-build-commands-here
Interestingly enough with #3, when I build locally, the zipped function is only 6.6 Mb, unzipped 29.6 Mb… so it seems like I should be well below the limits. What gives?
So, my questions is: How can I exclude that folder (chartjs/dist/docs/*) from being bundled with the function? What is the right filepath to either exclude or delete at build time?
Do you have what you need for the repro case ? Any ideas?
As I mentioned before, this is preventing us from shipping a major new feature (activity reports for our customers via email) and any information about your progress would help me decide how to manage things over here!
Note that, I’m not even using the Netlify build image at this point, testing in a vanilla Ubuntu 22.04 installation (with Git and Node installed). Since this is happening outside of Netlify, there’s not a lot we can do about it.
Boom, okay, thank you so much for this clear info. I should have thought of using an Ubuntu VM, but I was encouraged by the test-build docker image working.
I’ll pick apart the dependencies when building in Ubuntu and see if I can fix it another way…
Question: Is there any way to increase that function size limit for my account?
Not at the moment, unfortunately. This limit is imposed by AWS which sets it at 50 MB per zip (technically about 70, but that 20 MB is some overhead that AWS adds or needs).