serverless-offline-global-exporter

1.0.0 • Public • Published

Serverless Offline Global Exporter Plugin

Export all lambda functions to process.env

npm install --save-dev serverless-offline-global-exporter

On your plugins declaration

plugins:
  - serverless-offline-global-exporter
  - serverless-offline

All declared functions in your serverless.yml will be accessible in process.env.SERVERLESS_FUNCTIONS

functions:
  hello:
    handler: mymodule.myhandler
    memorySize: 128
    timeout: 30
 
const functionsList = JSON.parse(process.env.SERVERLESS_FUNCTIONS);
const lambdaToInvoke = functionsList[options['FunctionName']];
const lambda = require(lambdaToInvoke['mymodule']);
return lambda[lambdaToInvoke['myhandler']]({foo: 'bar'}, {}, callback);
 

Readme

Keywords

none

Package Sidebar

Install

npm i serverless-offline-global-exporter

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.84 kB

Total Files

4

Last publish

Collaborators

  • msfidelis