Skip to content

Pino integration strips error objects #17981

@InterstellarStella

Description

@InterstellarStella

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

10.20.0

Framework Version

Node 24.7.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

Repro app here.

Steps to Reproduce

Just need Node.js. Run pnpm i, add a data source name, and then finally pnpm run start.

Expected Result

The resulting log contains an error key with an object.

Actual Result

The object in the Sentry Web UI is empty.

In Pino's JSON output, the error is properly serialized:

"err": {"type":"Error","message":"This is an error.","stack":"Error: This is an error...."}

But in beforeSendLog (what gets sent to Sentry), the err attribute is empty:

"err": {}

Which means that the error details are being lost during serialization.

It appears that the Sentry Pino integration is intercepting log events before Pino serializes them. At that point, obj.err is still an actual Error instance. When Error objects are later stringified with JSON.stringify(), they become {} because Error properties are non-enumerable in JavaScript.

Additional Context

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions