menu

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

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.

Show previous messages

November 18, 2018 at 2:21am

@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

(our builders use webpack behind the scenes to filter out all the noise)

  • reply
  • like

So, the main point we're trying to help people with is

  • reply
  • like

The serverless environment is surfacing a lot of problems with the way even node_modules works and assumptions we've made in the past as a community

  • reply
  • like

Like, for example, that it's ok to ship readme.md changelog.md and all the tests with your server code

  • reply
  • like

Thats awesome. Yeah looking forward to the Next.js updates.

So added the config changes, and it deployed successfully however now im getting a 502 response and this error:

s Memory Size: 1024 MB Max Memory Used: 31 MB
2018-11-18T02:37:22.134Z Unable to import module 'now__launcher': Error
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
2018-11-18T02:37:22.134Z REPORT RequestId: e045a1e0-eada-11e8-8385-05ceb7fabb62 Duration: 0.63 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 31 MB

not sure if its related

like-fill
1
  • reply
  • like

November 19, 2018 at 5:53pm

Charlie, did you find what the now__launcher error is related to? I'm having the same issue when trying to deploy a nextjs app on now... first ran into the lambda limit and now I'm getting the 502 with the exact same now__launcher error.

  • reply
  • like

Charlie, did you find what the now__launcher error is related to? I'm having the same issue when trying to deploy a nextjs app on now... first ran into the lambda limit and now I'm getting the 502 with the exact same now__launcher error.

I ran into that issue when using zeit/next-css. Are you using anything in your next.config.js?

  • reply
  • like

I'm using typescript... the next.config.js looks like:

const withTypescript = require("@zeit/next-typescript");
module.exports = withTypescript();

the whole app is here: https://github.com/abnormalstudio/seafood-web

Edited
  • reply
  • like

Hey Jacob... you pointed me in the right direction! Had to move zeit/next-typescript into dependencies and out of dev-dependencies. :) Thank you!

  • reply
  • like

@leighhalliday Hey no I never did figure this out, however I do have some babel transpiler configuration in my `next.config.js

  • reply
  • like

so that would make sense if thats what the problem is related to

  • reply
  • like

Here's the blog post that @rauchg mentioned would be coming out related to maxLambdaSize: https://zeit.co/blog/customizable-lambda-sizes

  • reply
  • like