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:
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.
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.
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]"
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.
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?
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.