Skip to content

Deeply Nested objects aren't being serialised #1964

Closed
@drwharris

Description

@drwharris

Important Details

I have a Node JS 11.9 application

  • On-Premise docker [Version xyz]
  • Saas (sentry.io)
  • Other AWS Fargate

Description

Just upgraded the package to "@sentry/node": "^4.6.5" from "@sentry/node": "^4.5.4".

When adding objects to Addition Data I would see the following logged:

{
	ExMessage: ,
	level: error,
	Payload: {
		AcquisitionId: ,
		ClientId: ,
		DeviceData: {  <<  - Note this 
			Browser: {
				major: ,
				name: ,
				version:
			},
			Cpu: {},
			Device: {
				type:
			},
			Engine: {
				name: ,
				version:
			},
			Os: {
				name: ,
				version:
			}
		},
		Environment: ,
		EventDate: {},  <<  - Note this 
		Fingerprint: ,
		Geographical: {}, <<  - Note this 
		IpAddress: ,
		Referer: ,
		Sequence: ,
		SessionId: ,
		Type: ,
		Url: ,
		UserAgent: ,
		UserName: ,
		Version: ,
		Weather: {} <<  - Note this
	}
}

Unfortunately, now after upgrading I am getting:

{
	ExMessage: ,
	level: ,
	Payload: {
		AcquisitionId: ,
		ClientId: ,
		DeviceData: [Object],  <<- Note this
		Environment: ,
		EventDate: [Object],  <<- Note this
		Fingerprint: ,
		Geographical: [Object],  <<- Note this
		IpAddress: ,
		Referer: ,
		Sequence: ,
		SessionId: ,
		Type: ,
		Url: ,
		UserAgent: ,
		UserName: ,
		Version: ,
		Weather: [Object] <<- Note this
	}
}

Steps to Reproduce

I have this class

export class TrackerError extends Error {
	Payload: any;
	ExMessage: string;
	constructor(message: string, err: Error, payload: any) {
		super(message);
		if (err) {
			this.stack = this.stack
				.split("\n")
				.slice(0, 2)
				.join("\n") +
				"\n" +
				err.stack;
			this.ExMessage = err.message;
		} else {
			Error.captureStackTrace(this, this.constructor);
		}

		if (payload) {
			this.Payload = payload;
		}
	}
}

which I then use as follows:

Sentry.captureException(new TrackerError("My Error Message", myErrObj, myPayloadObj));

What you expected to happen

As per previous versions, deep objects should be logged in detail

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