# Lambda compliant compilation of node modules

**URL:** <https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [November 7, 2016, 9:55am UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730 "2016-11-07T09:55:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anthony/32/965_2.png) [@Anthony](https://forum.serverless.com/u/Anthony)\
**Post date:** [November 7, 2016, 9:55am UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730/1 "2016-11-07T09:55:10Z")

</div>

Some node libraries have to be compiled with a lambda compliant linux.

For example, I use `crypto` and I have to create an EC2 with an Amazon Linux AMI to build the module before I send it to lambda.

Does Serverless handle such a situation ?  
I believe send to lambda node modules compiled on my dev machine is really not a good practice.

---

<div class="post-metadata">

**Author:** ![enesdo](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@enesdo](https://forum.serverless.com/u/enesdo)\
**Post date:** [November 7, 2016, 10:00am UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730/2 "2016-11-07T10:00:14Z")

</div>

Not really answering your question, but I simply changed to pure javascript bcryp library. Using native libs is pain in the ass.

---

<div class="post-metadata">

**Author:** ![Anthony](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anthony/32/965_2.png) [@Anthony](https://forum.serverless.com/u/Anthony)\
**Post date:** [November 7, 2016, 11:53am UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730/3 "2016-11-07T11:53:57Z")

</div>

Thanks for your answer.

if you’re talking about `bcrypt.js` I have tested it and it is very very slow.

Anyway, the issue will exist with other libraries ☹

---

<div class="post-metadata">

**Author:** ![rowanu](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/rowanu/32/75_2.png) [@rowanu](https://forum.serverless.com/u/rowanu)\
**Post date:** [November 7, 2016, 7:12pm UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730/4 "2016-11-07T19:12:34Z")

</div>

No, Serverless does not compile native libs for you - it’s polyglot by default, so supporting all the various runtimes’ compilations is non-trivial.

AWS [just released an official AWS Linux container](https://aws.amazon.com/blogs/aws/new-amazon-linux-container-image-for-cloud-and-on-premises-workloads/) to help address use-cases like yours; With it you can compile native libraries consistently without using a development machine.

---

<div class="post-metadata">

**Author:** ![Anthony](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/anthony/32/965_2.png) [@Anthony](https://forum.serverless.com/u/Anthony)\
**Post date:** [November 8, 2016, 9:31am UTC](https://forum.serverless.com/t/lambda-compliant-compilation-of-node-modules/730/5 "2016-11-08T09:31:30Z")

</div>

ho great news I did not know, thank you 😉
