-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Lambda | ||
|
||
## Functions | ||
|
||
### `invokeLambdaFunction(input:{functionName: string; payload: object})` | ||
|
||
Invoke a Lambda function. | ||
|
||
Parameters: | ||
- `functionName`: the Lambda function name | ||
- `payload`: the payload/event to send to the Lambda function | ||
|
||
Note: `invokeLambdaFunction` automatically parses the response from the Lambda function and returns either a `string` or an `object` (JSON object) depending on the returned value of the Lambda function: if the Lambda function returns a string, the result will be of type string; if it returns an object, the result will be of type object. | ||
|
||
example: | ||
```typescript | ||
const result1 = await invokeLambdaFunction({ | ||
functionName: 'sum', | ||
payload: { | ||
a: 1, | ||
b: 2, | ||
}, | ||
}); | ||
|
||
console.log(result1) // 3 | ||
|
||
const result2 = await invokeLambdaFunction({ | ||
functionName: 'sum-json', | ||
payload: { | ||
a: 1, | ||
b: 2, | ||
}, | ||
}); | ||
|
||
console.log(result2) // { "result" : 3 } | ||
``` |