serverless-offline-global-exporter
v1.0.0
Published
Export all lambda functions to process.env
Downloads
1
Readme
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);