Skip to content

Bug: parser built-in schema accept empty Records array #3475

@Jimmy89

Description

@Jimmy89

Expected Behavior

Trying out the S3Schema parser with an empty records array passes validation. This should not occur.

Current Behavior

Output of success is true, while false was expected.

Code snippet

import { S3Schema } from '@aws-lambda-powertools/parser/schemas';
const event = { Records: [] };
const parsedEvent = await S3Schema.safeParseAsync(event);
console.log(parsedEvent.success); // <-- Output: true, expected: false  

Steps to Reproduce

Run code snippet above

Possible Solution

No response

Powertools for AWS Lambda (TypeScript) version

"@aws-lambda-powertools/parser": "2.13.0"

AWS Lambda function runtime

22.x

Packaging format used

npm

Execution logs

Zod version: 3.24.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompletedThis item is complete and has been merged/shippedparserThis item relates to the Parser Utility

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions