Skip to content

Receiving "**non-serializable** (TypeError: Cannot read properties of undefined (reading 'name'))" for an error property #15538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
patroza opened this issue Feb 28, 2025 · 3 comments · Fixed by #15556
Labels
Package: browser Issues related to the Sentry Browser SDK

Comments

@patroza
Copy link

patroza commented Feb 28, 2025

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.2.0

Framework Version

No response

Link to Sentry event

https://macs-holding.sentry.io/issues/6218488847/events/039f7b826c3d4864bbf132089ea3f611?project=4504671195299840&referrer=alert-rule-issue-list

Reproduction Example/SDK Setup

No response

Steps to Reproduce

Report an error which contains a property that is an object with a custom prototype like Header from effect: https://github.com/Effect-TS/effect/blob/main/packages/platform/src/Headers.ts#L44
Object.getPrototypeOf(Object.create({})) has no constructor

the problem in the SDK is here is a constructor assumed:

return prototype ? prototype.constructor.name : 'null prototype';

In EventBuilder you silently catch errors on that instead

Expected Result

no error inside Contexts cause.defect.response.headers

Actual Result

error

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 28, 2025
@github-actions github-actions bot added the Package: browser Issues related to the Sentry Browser SDK label Feb 28, 2025
@andreiborza
Copy link
Member

Hi @patroza, thanks for filing this.

The check in question should indeed ensure a constructor exists. I'll have a look at fixing this.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 Mar 3, 2025
andreiborza added a commit that referenced this issue Mar 3, 2025
Objects that are created from an Object with a null prototype were not
correctly handled before. `Object.getPrototypeOf` of such objects does
not return `null` directly but also do not have a constructor.

This fix guards against these cases.

Closes: #15538
@andreiborza
Copy link
Member

@patroza thank you again for filing this.

I pushed a fix for this which will go out with the next release.

Copy link
Contributor

github-actions bot commented Mar 5, 2025

A PR closing this issue has just been released 🚀

This issue was referenced by PR #15556, which was included in the 9.4.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: browser Issues related to the Sentry Browser SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants