Couchbase nodejs 4.1.0 sdk unzipped size causing an issue for lambda layers

We have our existing lambda layers using the CB nodejs 3.2.3 sdk which is being used in the lambda functions/handlers and the sdk when unzipped used to have a size of 13mb thus when used along with the functions would not cross total size of around 20mb

But with using the latest nodejs 4.1.0 sdk the unzipped file size of the layer itself is now around 245+mb thus the function/handler size now crossing the total limit of “250mb”

So my question is:

  1. why such large change of file size from 13mb to 240+mb
  2. is there a way to reduce the size of the sdk ( we use this for basic functionality to copy across the data into CB server )
  3. there seems to be folder named couchbase-cxx-client , couchbase-transactions-cxx under deps ( do we really need them for basic usage ? )

PS: did try to remove the couchbase-cxx-client which reduces the size by 40mb and it seems to work well as expected ( is that acceptable to remove those ? )
Also we dont want to switch to lambda containers as of yet to support 250mb+ size

Hey @pavan ,

If your application is performing a ‘pre-installation’ prior to zipping up the package for deployment on Lambda (as opposed to doing an npm install on lambda), it is safe to drop the src/ and deps/ folders which are both used as part of the generation of our complied binary (but once its built, are no longer needed).

Cheers, Brett

1 Like

I’d also mention that we moved from a small, tight C core to a C++ core that is leveraging a lot of templating, includes some debug info, etc. We do expect it to be larger as a result. There are some other optimizations possible, but I’d agree with Brett that the safest thing is probably just to toss the things not needed after build time.

Thank you @brett19 that would do for us :+1: also thanks @ingenthr for the explanation.