Skip to content

Unreadable error message #3363

Answered by dreamorosi
labbedaine asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thank you for opening this discussion.

The log you're seeing is the formatted version of the error. When you log an error using Logger, its key get formatted into a JSON-serializable object, which includes the stack trace.

At runtime, both event.error and event.error.cause are indeed errors and instances of respectively ParseError & ZodError which you can work with.

You can verify that this is the case with code similar to this:

import { z, ZodError } from 'zod';
import { Logger } from '@aws-lambda-powertools/logger';
import { parser } from '@aws-lambda-powertools/parser/middleware';
import { ParseError } from '@aws-lambda-powertools/parser';
import middy from '@middy/core';
import type 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dreamorosi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants