How to load npm modules in AWS Lambda?

前端 未结 5 1660
孤独总比滥情好
孤独总比滥情好 2020-12-04 05:16

I\'ve created several Lambda functions using the web based editor. So far so good. I\'d now like to start extending those with modules (such as Q for promises). I can\'t fig

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 05:33

    Hope this helps, with Serverless framework you can do something like this:

    1. Add these things in your serverless.yml file:

    plugins: - serverless-webpack custom: webpackIncludeModules: forceInclude: - (for example: node-fetch) 2. Then create your Lambda function, deploy it by serverless deploy, the package that included in serverless.yml will be there for you.

    For more information about serverless: https://serverless.com/framework/docs/providers/aws/guide/quick-start/

提交回复
热议问题