Skip to content

Internal Sentry Error: r._mergeOptions is not a function #2622

Closed
@NicHaley

Description

@NicHaley

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

5.15.5

Description

This error is related to another issue: #2541

As per the Advance Usage docs, I am trying to manage several instances of Sentry. I am developing a widget and would like to use Sentry without it conflicting with the host page.

Based on the documentation and suggestions from this thread, I am achieving this using a new Hub instance, and calling the run method inside the widget.

My (simplified) code looks like:

const client = new BrowserClient({
  dsn: process.env.SENTRY_DSN,
  integrations: [
    new Sentry.Integrations.InboundFilters(),
    new Sentry.Integrations.UserAgent(),
    new Sentry.Integrations.Breadcrumbs()
  ]
});

const hub = new Hub(client);

// Based on https://github.com/getsentry/sentry-javascript/issues/2541
hub.bindClient(client);
...

hub.run((currentHub) => {
    currentHub.captureException(error);
});

For host pages without Sentry, everything works well. However, on host pages where Sentry is already being used, internal Sentry exceptions are being thrown from each Sentry package. This line breaks with the message r._mergeOptions is not a function.

This error will appear in both Sentry projects. It appears that somehow they might be breaking each other, and logging the exception. Integrations do not work in these exceptions, I assume because it's the integrations that are breaking.

There are still other exceptions that are logged correctly by both projects, so it's unclear when or how this situation arises. It's also unclear if this error is gobbling other exceptions.

This is a major use-case for our organization. Hoping for a fix or suggestion so that we can resolve quickly (for now we need to turn Sentry off).

Links to the issue:

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