TypeScript icon, indicating that this package has built-in type declarations

    3.1.0 • Public • Published

    Middy AWS event parse and normalization middleware

    Middy logo

    AWS event parsing and normalization middleware for the middy framework, the stylish Node.js middleware engine for AWS Lambda

    npm version npm install size GitHub Actions CI status badge
    Standard Code Style Known Vulnerabilities Language grade: JavaScript Core Infrastructure Initiative (CII) Best Practices
    Chat on Gitter Ask questions on StackOverflow

    You can read the documentation at: https://middy.js.org/docs/middlewares/event-normalizer

    Middleware for iterating through an AWS event records, parsing and normalizing nested events.

    AWS Events Transformations: https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html

    Event Source Included Comments
    Alexa No Normalization not required
    API Gateway (HTTP) No * See middleware prefixed with @middy/http-
    API Gateway (REST) No * See middleware prefixed with @middy/http-
    API Gateway (WS) No Opportunity for new middleware
    Application LB No * See middleware prefixed with @middy/http-
    CloudFormation No Normalization not required
    CloudFront No Normalization not required
    CloudTrail No Normalization not required
    CloudWatch Logs Yes Base64 decode and JSON parse data
    CodeCommit No Normalization not required
    CodePipeline Yes JSON parse UserParameters
    Cognito No Normalization not required
    Config Yes JSON parse invokingEvent and ruleParameters
    Connect No Normalization not required
    DynamoDB Yes Unmarshall Keys, OldImage, and NewImage
    EC2 No Normalization not required
    EventBridge No Normalization not required
    IoT No Normalization not required
    IoT Event No Normalization not required
    Kafka Yes Base64 decode and JSON parse value
    Kafka (MSK) Yes Base64 decode and JSON parse value
    Kinesis Firehose Yes Base64 decode and JSON parse data
    Kinesis Stream Yes Base64 decode and JSON parse data
    Lex No Normalization not required
    MQ Yes Base64 decode and JSON parse data
    RDS No Normalization not required
    S3 Yes URI decode key
    S3 Batch Yes URI decode s3Key
    S3 Object Lambda No * See middleware @middy/s3-object-response
    Secrets Manager No Normalization not required
    SES No Normalization not required
    SNS Yes JSON parse Message
    SQS Yes JSON parse body

    * Handled in another dedicated middleware(s)

    Test Events Some events send test events after set, you will need to handle these.

    // S3 Test Event
      Service: 'Amazon S3',
      Event: 's3:TestEvent',
      Time: '2020-01-01T00:00:00.000Z',
      Bucket: 'bucket-name',
      RequestId: '***********',
      HostId: '***/***/***='


    To install this middleware you can use NPM:

    npm install --save @middy/event-normalizer

    Sample usage

    import middy from '@middy/core'
    import eventNormalizer from '@middy/event-normalizer'
    const lambdaHandler = (event, context) => {
      const { Records } = event
      for(const record of Records) {
        // ...
    const handler = middy(lambdaHandler).use(eventNormalizer())

    Middy documentation and examples

    For more documentation and examples, refers to the main Middy monorepo on GitHub or Middy official website.


    Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.


    Licensed under MIT License. Copyright (c) 2017-2022 Luciano Mammino, will Farrell, and the Middy team.

    FOSSA Status
    Tip: Click on a version number to view a previous version's package page

    Current Tags

    Version History


    npm i @middy/event-normalizer



    DownloadsWeekly Downloads






    Unpacked Size

    19.5 kB

    Total Files


    Last publish


    • lmammino
    • middyjs
    • willfarrell