Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

ZEIT

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

ZEIT / General

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

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

ZEIT/General · November 18, 2018 at 1:37am

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

ZEIT / General · November 18, 2018 at 1:37am

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.

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.

  • reply
  • like

In the case of @now/next, @timneutkens is working on lowering the 'base runtime size' quite drastically.

  • reply
  • like

There's no reason it should be 2mb for a "Hello World", and we are working on addressing that.

  • reply
  • like

(not sure if you're using next in this case, but wanted to mention that)

  • reply
  • like

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?

  • reply
  • like

Inside the build definition, inside the config flag

  • reply
  • like

and you can use a string like "5mb"

  • reply
  • like

@rauchg, 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?

  • reply
  • like

@gary-jennings pretty much. In general, the argument is a bit more nuanced, and we're writing a bit more on Monday to illustrate this

  • reply
  • like

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

  • reply
  • like

For one, with technologies like Next.js and Nuxt and many others, pages are universal

  • reply
  • like

Therefore, the client has all the code and information necessary to render each page

  • reply
  • like

Would you argue for shipping more than 5mb of minified + gzipped code to a browser to render a page?

  • reply
  • like

With @now/node, we are aiming to target the "route-based" or "entrypoint-based" code execution usecase

  • reply
  • like

With @now/node-server, we are not, therefore we've now made the soft limit much higher

  • reply
  • like

(to be announced on Monday as well)

  • reply
  • like

This is all improving a lot by the way based on the excellent feedback from the community here

  • reply
  • like

@rauchg ^ 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

  • reply
  • like

Yep, that's an artifact of @now/next not being as good as we want it to be yet

  • reply
  • like

But this is the beauty of serverless too IMO

  • reply
  • like

It's a forcing function (pun somewhat intended) that is making everyone's code better, including ours

  • reply
  • like

Check this out:

  • reply
  • like

I deployed `apollo`, `express`, `graphql` and everything it comes with. Sure, it's a "hello world", but even that

  • reply
  • like
▲  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]

  • reply
  • like

is 947kb!

  • reply
  • like
Your message here...

*bold*_italic_`code````codeblock```