Skip to content

TypeError: Attempting to define property on object that is not extensible. #9030

Description

@jamesdiacono

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/vue

SDK Version

7.69.0

Framework Version

3.2.47

Link to Sentry event

https://crosscountry-app.sentry.io/issues/4477507356/

SDK Setup

import {init} from "@sentry/vue";
...
init({
    app: vue_app,
    dsn: sentry_dsn,
    release: "xxx"
});

Steps to Reproduce

Pass a frozen callback function to setTimeout, using Safari v16.6:

function callback() {
    console.log("Hello");
}
setTimeout(callback, 50); // OK
Object.freeze(callback);
setTimeout(callback, 50); // BOOM!

Stacktrace:

TypeError: Attempting to define property on object that is not extensible.
c — object.js:63
ze — helpers.js:129
(anonymous function) — trycatch.js:100
Global Code

In @sentry/utils/esm/object.js:

function markFunctionWrapped(wrapped, original) {
  const proto = original.prototype || {};
  wrapped.prototype = original.prototype = proto; // <-- this line throws the exception
  addNonEnumerableProperty(wrapped, '__sentry_original__', original);
}

Expected Result

No exception.

Actual Result

An exception is thrown by Sentry.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions