diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index ea51d25770..d3e630ddf1 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -504,6 +504,7 @@ function callback(cb: AWSLambda.Callback) { cb(); cb(null); cb(error); + cb(str); // https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html cb(null, anyObj); cb(null, bool); cb(null, str); diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 4b62269902..dd3fd3bd4e 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -18,6 +18,7 @@ // David Hayden // Chris Redekop // Aneil Mallavarapu +// Jeremy Nagel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -661,9 +662,11 @@ export type Handler = ( * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html * * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. + * It can be a string for Lambda Proxy Integrations + * https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ -export type Callback = (error?: Error | null, result?: TResult) => void; +export type Callback = (error?: Error | null | string, result?: TResult) => void; // Begin defining Handler and Callback types for each API trigger type. // Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html