Skip to content

Constant "self._mergeOptions is not a function." #5572

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
KoryNunn opened this issue Aug 12, 2022 · 8 comments
Closed
3 tasks done

Constant "self._mergeOptions is not a function." #5572

KoryNunn opened this issue Aug 12, 2022 · 8 comments

Comments

@KoryNunn
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/browser

SDK Version

7.8.1

Framework Version

No response

Link to Sentry event

https://sentry.io/organizations/gritlife/issues/3488117873/?project=6136884

Steps to Reproduce

No idea. 90% of our events are this error. v6 used to send almost only self._handler is not a function

We install via NPM and bundle with browserify.

We initialize via:

const Sentry = require('@sentry/browser');
const { Integrations } = require('@sentry/tracing');

Sentry.init({
  integrations: [new Integrations.BrowserTracing()],
  ...config.sentry
});

The only potentially relevant note is that we do add a global error handler to handle one specific third-party issue, and re-throw all errors that are not the error we are after, basically:

window.addEventListener('error', event => {
  // Check if it's one specific error

  // If not, rethrow in a new stack to escape promises.
  setTimeout(function () {
    throw event.error;
  });
});

Expected Result

Not get this internal sentry bug.

Actual Result

We get this issue reported.

@lforst
Copy link
Contributor

lforst commented Aug 12, 2022

Hi, thanks for writing in. In 99% of the cases this happens when there are either two different versions of the Sentry SDK initialized, or when there is a version mismatch of installed Sentry packages.

Please make sure you're only initializing the Sentry SDK once on the whole website and make sure all of Sentry's SDK packages are on the same version. (So for example that @sentry/browser is on 7.8.1, @sentry/tracing is on 7.8.1, @sentry/hub is on 7.8.1 etc - check your lockfiles and node_modules if there is anything stale in there)

Prev: #2622 (comment), #5339, #4956

@KoryNunn
Copy link
Author

Could this be because we are also running @sentry/cordova, which has an interval version of [email protected]?

Should the cordova plugin be updated?

@lforst
Copy link
Contributor

lforst commented Aug 16, 2022

Yes, that's very likely the cause. Make sure only @sentry/cordova is installed (it has @sentry/browser as dependency), or find a way to isolate your dependencies so that the dependencies don't interfere with eachother.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2022

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@matheusgoc
Copy link

I'm facing this same problem by setting up Sentry at React. Has anyone face the same issue at React? I'm just following basic directions at docs => https://docs.sentry.io/platforms/javascript/guides/react

@lforst
Copy link
Contributor

lforst commented Feb 1, 2023

@matheusgoc This shouldn't be specific to the React SDK. Usually, this happens if multiple different versions of the Sentry SDK are installed on the same page, and or the versions of its dependencies (e.g. @sentry/browser, @sentry/core) are mismatching. Can you check in your package.json and/or lockfile if that could be the case?

@matheusgoc
Copy link

Hi @lforst. thank you for helping me! I only have @sentry/react and @sentry/tracing at package.json. I'm using Sentry ^7.34.0 with React ˆ18.2.0 and Typescript. This is how my React bootstrap code looks like:

Sentry.init({
  dsn: process.env.REACT_APP_SENTRY_DSN,
  integrations: [new BrowserTracing()],
  tracesSampleRate: 1.0,
});

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(<App />);

@lforst
Copy link
Contributor

lforst commented Feb 2, 2023

@matheus Can you also check your lockfile whether you have any other versions of the SDK installed? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants