menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

ZEIT

Our mission is to make cloud computing as easy and accessible as mobile computing. You can find our Next.js community here.

Channels
Team

Getting an error that lambda function size exceeds 5mb limit.

November 18, 2018 at 1:37am
The ZEIT community has a new home. This thread is preserved for historical purposes. The content of this conversation may be innaccurrate or out of date. Go to new community home →

Getting an error that lambda function size exceeds 5mb limit.

November 18, 2018 at 1:37am
Image
This is the error I'm getting, and it says you can increase the maxLambdaSize, however according to your docs (below) this is not possible.
Image
I literally just have one index.jsx file, and a Graphql query in my src and thats it right now. What do I do? Thanks.

November 18, 2018 at 1:39am
We are in the process of updating the posts and releasing a blog post about it. It's safe to bump maxLambdaSize indeed, but do so with the understanding that it might impact perf.
In the case of /next, is working on lowering the 'base runtime size' quite drastically.
There's no reason it should be 2mb for a "Hello World", and we are working on addressing that.
(not sure if you're using next in this case, but wanted to mention that)
Thanks for the quick response!
Yeah I am using next so that is good to know.
So I'm assuming maxLambdaSize should be placed in now.json? And is it just an int value to increase the size?
Inside the build definition, inside the config flag
and you can use a string like "5mb"
, if we stay under 5mb, we get the benifit of never caring about cold starts, if we have the option of going past 5mb, then cold starts becomes something we will start to experience?
pretty much. In general, the argument is a bit more nuanced, and we're writing a bit more on Monday to illustrate this
If you're doing API work or server-rendering for example, it'd be pretty strange to have more than 5 megabytes of compressed and minified code per entrypoint
For one, with technologies like Next.js and Nuxt and many others, pages are universal
Therefore, the client has all the code and information necessary to render each page
Would you argue for shipping more than 5mb of minified + gzipped code to a browser to render a page?
With /node, we are aiming to target the "route-based" or "entrypoint-based" code execution usecase
With /node-server, we are not, therefore we've now made the soft limit much higher
(to be announced on Monday as well)
This is all improving a lot by the way based on the excellent feedback from the community here
^ this is why I was most confused, because I'm building a Next.js app that is minifying a single index page and a single api call, and its compressing to 6.7mb
Yep, that's an artifact of /next not being as good as we want it to be yet
But this is the beauty of serverless too IMO
It's a forcing function (pun somewhat intended) that is making everyone's code better, including ours
Check this out:
I deployed `apollo`, `express`, `graphql` and everything it comes with. Sure, it's a "hello world", but even that
▲ apollo/ (add-apollo) now -f
> Deploying ~/Projects/now-examples/apollo under now-examples
> https://apollo-4f726vwx0.now.sh [v2] [in clipboard] [3s]
┌ index.js Ready [32s]
└── λ index.js (947.35KB) [sfo1]
> Success! Deployment ready [38s]
is 947kb!
Show more messages