'AWS CDK Typescript Lambda Handler Event Type

I'm using CDK to create my serverless app, and I current have a lambda trigger by an S3 put event, like so:

const function = new NodejsFunction(this, `id-here`, {
            entry: path.join(__dirname, '/../src/lambda/index.ts'),
            ...more props
        });

function.addEventSource(new eventsources.S3EventSource(this.myBucket, {
            events: [ s3.EventType.OBJECT_CREATED ],
            filters: [ ... ]
        }));

I can't seem to find, by looking through the docs, what type I should be using in my typescript handler:

export const handler  = (event: <What goes here?>) => {

    //some stuff

    return someThing
}

Thanks in advance!



Solution 1:[1]

The events your Lambda receives will be of the type S3Event from the @types/aws-lambda package:

export interface S3Event {
    Records: S3EventRecord[];
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 fedonev