#2132·pino

pino/browser: Error not serialized correctly

Author: lennerdCreated Feb 19, 2025Updated Mar 23, 2026

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

typescript
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?