-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot assign to read only property 'debug' of object '#<Object>' #14368
Comments
Thanks for writing in. We are patching the console object which normally is writable. Would you mind checking your codebase for any code that may make the consol object readonly (ie, frozen or |
We observe this error occurring for approximately 1% of users (based on sentry transactions), while the rest use the site without such issues. This makes it seem unlikely that the problem lies in our code. Initially, we considered potential causes like browser extensions or Google Tag Manager (GTM). However, GTM is loaded after the application’s initialization, so it’s unlikely to be the source. Regarding browser extensions, we cannot confirm since we lack metadata about them in Sentry. Additionally, most of our traffic comes from mobile devices rather than desktops, which reduces the likelihood of extension-related issues. Currently, our plan is to wrap the Sentry initialization in a try/catch block and attempt to manually send the error data if the initialization fails. |
Although the problem here is likely something other then the Sentry SDK, it does not hurt for us to handle this more gracefully and do not throw an error if we encounter such a problem! We'll try to adjust the SDK accordingly. |
This PR adds a guard to avoid us throwing if we try to fill a readonly property on an object. Generally speaking this should not work, but it does not hurt us to be defensive here and try-catch this to avoid breaking users apps. Fixes #14368
A PR closing this issue has just been released 🚀This issue was referenced by PR #14402, which was included in the 8.40.0 release. |
Is there an existing issue for this?
How do you use Sentry?
Self-hosted/on-premise
Which SDK are you using?
@sentry/react
SDK Version
8.30.0
Framework Version
18.2.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
In exceptions reported by our clients, we observe an error where Sentry’s breadcrumbs integration seems to overwrite the console.debug method, but the method is unexpectedly readonly. This issue occurs before the full initialization of the Sentry client, and as a result, the events are not enriched with even basic browser metadata. Despite searching for similar issues, no solutions or explanations have been found online.
Do you have any insights into what might cause this or suggestions on how best to handle this case?
Expected Result
No error should be thrown
Actual Result
TypeError
Cannot assign to read only property 'debug' of object '#'
The text was updated successfully, but these errors were encountered: