# @apphandler/lambda

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

Latest version **3.1.2** (published 2022-05-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install @apphandler/lambda
pnpm add @apphandler/lambda
yarn add @apphandler/lambda
bun add @apphandler/lambda
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2022-05-30 |
| First published | 2021-07-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | npm@apphandler.io |
| Maintainers | apphandler |

## Links

- npm: https://www.npmjs.com/package/@apphandler/lambda
- npm.io page: https://npm.io/package/@apphandler/lambda

## Recent versions

- 3.1.2 (latest) — 2022-05-30
- 3.1.1 — 2022-05-30
- 3.1.0 — 2022-05-30
- 3.0.1 — 2022-04-11
- 3.0.0 — 2022-04-01
- 2.0.4 — 2022-03-31
- 2.0.3 — 2021-10-22
- 2.0.2 — 2021-10-22
- 2.0.1 — 2021-10-22
- 2.0.0 — 2021-08-09
- 1.4.0 — 2021-08-09
- 1.3.0 — 2021-07-24
- 1.2.0 — 2021-07-23
- 1.1.0 — 2021-07-08

## README

### 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_
```js
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_
```js
var mylambda = require('mylambda')
.
.
.
exports.handler = async (event) => {
  let result = await mylambda.invokeLambdaEvent("xxxx-echo",event)
  return {
    statusCode: 200,
    body: "Echo function Triggered(hopefully 😁)"
  }
}
```

---
_Source: https://npm.io/package/@apphandler/lambda · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
