Home
Support Forums

Request must be smaller than 69905067 bytes for the CreateFunction

Hi all, I’ve just started working with Serverless Functions on Netlify and I’m having trouble deploying my API.

I’ve built a Graphql API using Prisma (full repo here, please ignore the readme, just personal notes on how it works). The API works well locally, but I have not been able to deploy it.

Initially I was getting this error when deploying:

Error: In file "/home/leonardo/mci-backend/dist/server.js": Cannot find module 'aws-lambda'
Require stack:
- /home/leonardo/mci-backend/node_modules/@netlify/zip-it-and-ship-it/src/resolve.js
- /home/leonardo/mci-backend/node_modules/@netlify/zip-it-and-ship-it/src/dependencies.js
- /home/leonardo/mci-backend/node_modules/@netlify/zip-it-and-ship-it/src/main.js
- /home/leonardo/mci-backend/node_modules/@netlify/zip-it-and-ship-it/src/bin.js

But adding aws-lambda to my package.json fixed it, I’m not sure if that’s the way I was supposed to fix it, but since it’s working I won’t complain.

I’m now facing another issue when building:

11:02:08 AM: Request must be smaller than 69905067 bytes for the CreateFunction operation
11:02:08 AM: Request must be smaller than 69905067 bytes for the CreateFunction operation

This is happening on two of my files, schema.zip and server.zip which are respectively 62,223kb and 66,509kb.

Googling makes me realise these two are simply too big to upload, but I honstly have no clue how I could possibly make them any smaller as they’re already really barebones.

Any idea how I can get out of this?

Here’s my full build log: https://pastebin.com/5XZQfu0b

Hi @creativiii and welcome to our community!

Unfortuantely, neither of those two files can go into your lambda. You’ll need smaller datasets to run a Lambda function, whether you do it through Netlify or direct on AWS; this is their limitation and not ours. (cf https://docs.amazonaws.cn/en_us/lambda/latest/dg/gettingstarted-limits.html)

Hopefully you can either deploy a subset of your data, or you can get that data accessible via the function (probably not “download all of it, unpack it, use it” but instead an use an API that returns those values quickly with a lookup).

I think I have an answer for you. Are you using aws-sdk v3? If so, it pulls in a gargantuan number of dependencies - most of which are unnecessary. This issue links to what I’m dealing with: Needing to pull in react-native to work with AWS Step Functions.

I’m new to using Netlify at this level, but I suspect that if there’s a tree-shaking plugin it might be possible to slim your bundle down and make it work after all. I’m on AWS SDK v3 - are you on an earlier version? It’s possible that might help too.

1 Like

Very good explanation. Thanks for your article

Addendum for whoever runs into this themselves: After some fiddling, I rolledback to AWS SDK v2 and that solved this issue for me.

2 Likes

thanks for sharing! its appreciated.

Interesting stuff to read. Keep it up.
Thank you.