Skip to content

ParseError no longer use the error.cause property #2773

Closed
@tusharf5

Description

@tusharf5

Expected Behavior

Earlier the error thrown within the handler would be attached to the ParseError to the .cause property. This no longer is the case. This broke one of our prod services that were relying on this property.

I think it was unintentionally removed as part of dropping Node 16 support.

Here's the link to the change.

e4eee73#diff-27fac689aa83bd57991ab46c30f4cd72584c529baa433ce899e8b7bd6db7a7deL21

Current Behavior

ParseError.cause is undefined

Code snippet

Just throw any validation error in the handler and look for error.cause property.

Steps to Reproduce

You can run any tests in this file "packages/parser/tests/unit/envelope.test.ts" and check for error.cause property. It will be undefined.

Possible Solution

I've submitted a PR which reverts the ParseError change that removed this behaviour.

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

20.x

Packaging format used

npm

Execution logs

No response

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