The only way we found to debug this is by uploading the failed function bundle to Dropbox (that's the only cloud storage I could find which provides an easy-enough way to upload files via API). You could follow this guide: Generate an access token for your own account - Dropbox.
- Generate a temporary access token for a Dropbox account. You can set that token as an environment variable with the name
DROPBOXin Netlify. - Copy the current folder in the root of the application where you are experiencing the
250 MB limiterror. i.e:web-marketplace/netlify-plugin-upload-function-bundle).- The folder should contain an
index.jsfile with the script to upload the function bundle to Dropbox. - In the same folder, there should be a
manifest.ymlfile too.
- The folder should contain an
- Finally, add or modify your
netlify.tomlwith the following code:
[[plugins]]
package = "./netlify-plugin-upload-function-bundle/"
// The path should be relative to the base path configured in site settings in Netlify.Once you run a deploy with this, on every failure, you should get the Function bundle uploaded to Dropbox. Then you can download that bundle and inspect it to find what dependencies are inflating the bundle size and exclude them in the [functions]/included_files section in the Netlify.toml:
[functions]
included_files = [
"!node_modules/PACKAGE_TO_EXCLUDE/**/*",
]and the outputFileTracingExcludes section in the next.config.mjs:
outputFileTracingExcludes: {
'*': [
'./node_modules/PACKAGE_TO_EXCLUDE',
],