3.1.2 • Published 2 years ago

@apphandler/lambda v3.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Use await with these functions

When using this modules for both invokeLmabda and invokeLambdaEvent the keyword await must be used.

Although the second one is an event based (async) which immediatly returns (statusCode: 202 with empty payload), if you don't await on this invokation while being used the handler of the function might returned and process gets exited before invokation.

Use invokeLambdaEvent only when don't require response form the second function and it acts like a trigger.

Sample Use case

We want to invoke echo function and get some result from it and return to user. This is inside current (1st) function

var mylambda = require('mylambda')
.
.
.
exports.handler = async (event) => {
  let result = await mylambda.invokeLambda("xxxx-echo",event)
  return {
    statusCode: 200,
    body: JSON.stringify(result.body)
  }
}

We want to invoke echo function and get some result from it and return to user. This is inside current (1st) function

var mylambda = require('mylambda')
.
.
.
exports.handler = async (event) => {
  let result = await mylambda.invokeLambdaEvent("xxxx-echo",event)
  return {
    statusCode: 200,
    body: "Echo function Triggered(hopefully 😁)"
  }
}
3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.4

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

1.4.0

3 years ago

2.0.0

3 years ago

1.2.0

3 years ago

1.3.0

3 years ago

1.1.0

3 years ago