Skip to content

pino/browser: Error not serialized correctly #2132

Description

@lennerd

Hey there,

we are using pino for the browser. Looks like the serializer for Error instances does not use the provided messageKey when serializing the error. The property from the error object are also not wrapped in an err object, like stated here: https://getpino.io/#/docs/api?id=errors

pino({ browser: { asObject: true, serialize: true }, messageKey: 'message' }).error(new Error('Something went wrong'));

Output in Node:

{"level":50,"time":1739977190475,"err":{"type":"Error","message":"Something went wrong","stack":"Error: Something went wrong ..."},"message":"Something went wrong"}

Output in the browser:

{"time":1739977722493,"level":50,"type":"Error","msg":"Something went wrong","stack":"Error: Something went wrong..."}

Are we doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions