0.2.0 • Published 9 months ago
lambda-spawn v0.2.0
lambda-spawn
Run lambda function as child process.
Installation
npm i lambda-spawn
Usage
const {
INVOKE_RESULT,
spawnLambda,
} = require('lambda-spawn');
const options = {
handler: 'index.handler',
moduleDir: 'path/to/lambda',
};
const lambdaProcess = spawnLambda(options, event, context);
lambdaProcess.on(INVOKE_RESULT, ({ result }) => {
});
API
spawnLambda(options, event, context)
options.arn
- An ARN that identify a lambda process.
options.dir
- A current directory of the lambda process.
- Default:
process.cwd()
options.handler
- Names of a module and a function.
- Default:
index.handler
options.env
- An object of environment variables that is used to launch a lambda process.
- Default:
process.env
options.lambdaEnv
- An object of environment variables that is used as the lambda configuration.
- This object is merged to
options.env
.
options.moduleDir
- A path of a directory that the lambda function is located.
options.typescript
- If this option is truthy,
ts-node
is used to launch a lambda process.
- If this option is truthy,
event
- An event object that is used to invoke the lambda function.
context
- A context object that is used to invoke the lambda function.
LambdaProcess
Properties
arn
- An ARN that is passed to
spawnLambda
.
- An ARN that is passed to
Event: lambda.INVOKE_RESULT
The lambda.INVOKE_RESULT
event is emitted when the lambda function returns the result.
This event passes a message object to a listener. The message object has following properties:
err
- An Error object when the lambda function returns an error.
result
- A result that is returned by the lambda function.
License
MIT
0.2.0
9 months ago
0.1.10
3 years ago
0.1.8
4 years ago
0.1.7
4 years ago
0.1.9
4 years ago
0.1.6
4 years ago
0.1.5
4 years ago
0.1.4
4 years ago
0.1.3
5 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.11
6 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago