Skip to content

Commit 4de3f74

Browse files
committedApr 21, 2021
Document usage with async await
1 parent 21b2d2c commit 4de3f74

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ lambda.invoke('some-lambda', { some: 'event' }, callback);
3232
to 5 seconds.
3333
- `max_idle`: The idle timeout to use in milliseconds. If a function is
3434
not invoked for this time, the process gets destroyed. Defaults to 1 hour.
35-
- `lambda.invoke(lambda_name, event[, options], callback)`: Invokes the named
36-
Lambda `handle` function. These options are supported:
35+
- `lambda.invoke(lambda_name, event[, options][, callback])`: Invokes the named
36+
Lambda `handle` function. If no callback is given, a promise is returned.
37+
These options are supported:
3738
- `awsRequestId`: The AWS request ID to use in the Lambda `context`.
3839
If a context is given, but one of the above properties is missing, they are
3940
added to the context.
@@ -50,7 +51,7 @@ lambda.invoke('some-lambda', { some: 'event' }, callback);
5051

5152
## Lambda context
5253

53-
Lambda function are invoked with `(event, context, callback)` where the
54+
Lambda function are invoked with `(event, context[, callback])` where the
5455
`context` has this interface:
5556

5657
- `functionName`: The name of the Lambda function.
@@ -63,6 +64,8 @@ Lambda function are invoked with `(event, context, callback)` where the
6364
- `getRemainingTimeInMillis()`: Returns the remaining time until the Lambda
6465
function times out.
6566

67+
If `callback` is not defined (the lambda handler function has an arity < 3), the function is expected to return a promise.
68+
6669
## Debugging Lambda functions
6770

6871
If the environment variable `STUDIO_LAMBDA_INSPECT` is set to the name of a

0 commit comments

Comments
 (0)