Request must be smaller than 69905067 bytes for the CreateFunction operation

I previously reported that dependencies are not being automatically installed in my 4 functions under /functions/foo/package.json and /functions/bar/package.json, etc.

I have added to netlify.toml the following plugin:

[[plugins]]
package = “@netlify/plugin-functions-install-core”

This seems to be the solution, but builds are failing with:

Request must be smaller than 69905067 bytes for the CreateFunction operation

Any insight on what could be causing this error?

My functions are all relatively simple, mostly only calling node-fetch, firebase-admin and one other dependency.

It seems self-evident that we would want dependencies in functions to be npm installed. It’s hard for me to understand why information on how to make this happen isn’t readily available.

Hey @question_asker,

AFAIK, the Lambda package must remain under 64MB (I think, ideally, it should be under 50MB). It’s not a frequent build error (51 times in the last 7 days – I checked).

Do you have one netlify.toml at the root of your directory, by the way? A little unrelated but when I was sleuthing, I stumbled upon this.

Hi @Scott ,

I’m getting this same error on my site, pk-postmaker. The function is “screenshot-v1.” Zipped, it comes out to 49.8 MB, so it should be in the clear, right?

But the deploy still fails with this message.

" [Request must be smaller than 69905067 bytes for the CreateFunction operation]"

Please advise.

Hey there, @platform-kit

Sorry to hear you’re having this issue. Can you share your Netlify site name, as well as your recent build logs?

Hi @hillary

the site name is pk-postmaker.

Here’s the error, from the latest build log:

4:08:15 PM: ────────────────────────────────────────────────────────────────
4:08:15 PM: 3. Deploy site
4:08:15 PM: ────────────────────────────────────────────────────────────────
4:08:15 PM: ​
4:08:15 PM: Starting to deploy site from ‘dist’
4:08:16 PM: Creating deploy tree
4:08:16 PM: Creating deploy upload records
4:08:16 PM: 0 new files to upload
4:08:16 PM: 1 new functions to upload
4:08:23 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:24 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:25 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:27 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:30 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:32 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:36 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:43 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:08:50 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:09:01 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:09:19 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
4:09:47 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation

Edit: Since posting this, I retried the deploy and it worked. The code hasn’t changed. :person_shrugging:

Second edit:

And now on the very next deploy, I got the error again:

12:55:43 PM: Starting to deploy site from ‘dist’
12:55:44 PM: Creating deploy tree
12:55:44 PM: Creating deploy upload records
12:55:44 PM: 0 new files to upload
12:55:44 PM: 1 new functions to upload
12:55:51 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:55:53 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:55:56 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:55:58 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:00 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:03 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:07 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:15 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:21 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:32 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:56:50 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:57:18 PM: Request must be smaller than 69905067 bytes for the CreateFunction operation
12:57:18 PM: Failed to upload file: screenshot-v1
12:57:18 PM: Site deploy was successfully initiated
12:57:18 PM: ​
12:57:18 PM: (Deploy site completed in 1m 35.4s)
12:57:18 PM: ​
12:57:18 PM: ────────────────────────────────────────────────────────────────
12:57:18 PM: Netlify Build Complete
12:57:18 PM: ────────────────────────────────────────────────────────────────
12:57:18 PM: ​
12:57:18 PM: (Netlify Build completed in 3m 29.6s)
12:57:19 PM: Execution cancelled
12:57:19 PM: Error running command: Command was cancelled
12:57:19 PM: Failing build: Failed to build site
12:57:19 PM: Finished processing build request in 5m3.465417746s

Hey @platform-kit, unfortunately I think the error message says it all. The function bundle is too big. It’s possible that we add some env variables to functions in order for everything to work correctly. Is there a way to pull out some dependencies or make API calls from the function instead of including extra assets in the bundle?

@jen IDK if you have the ability to look at the zipped functions, but the one in question (“screenshot-v1”) is under the 50mb limit.

And clearly the filesize is not the actual issue, as it is allowing me to deploy occasionally.

Can you link us to a deploy that succeeds so we can take a look?

@jen

Looks like you created that deploy from the CLI, it wasn’t built from git- is that right?

@jen Yes, that may be correct. I was trying anything and everything! Hahaha. However many of the CLI deployments failed with the same error.

69905067 bytes is 69 MB. This function is 48.9mb.

I hear what you’re saying that your function bundle should fit into the 50MB that @Scott mentioned above- but the error is an AWS Lambda error (that’s what our functions are “under the hood”), not a Netlify error. It’s not a size constraint we can increase or adjust. It’s possible that we ship additional environment variables with your function bundle that increase the bundle’s size from 48.9MB to a larger number.

I’d suggest breaking up your function into something smaller, removing unnecessary dependencies, hosting large assets outside of the function and calling them from within the running function, etc. One other thing you can try is bundling with esbuild as described here: File-based configuration | Netlify Docs

@jen thanks, I will look into the file-based config. But there’s no reason that Netlify should be adding 20mb worth of ENV variables. Something else is going on.

@jen - just a bit of follow up, perhaps it will lead to some useful insights around this bug.

I refactored my function and built a new one that comes out to roughly the same size.

Able to deploy one at 49 MB and another at 44 - although only via CLI.

My hunch is that the issue is not the file size but something happening in the deployment process.

The previous build of these functions included a build step that downloaded Chrome/Puppeteer.

Now the binary is included directly in the node dependencies. That seems to alleviate the error message.

2 Likes