Skip to content

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

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
5 of 9 tasks
NicHaley opened this issue May 27, 2020 · 36 comments · Fixed by #3458
Closed
5 of 9 tasks

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

NicHaley opened this issue May 27, 2020 · 36 comments · Fixed by #3458

Comments

@NicHaley
Copy link

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:

@kamilogorek
Copy link
Contributor

Hey, I spent some time today trying to reproduce this issue, but I was not able to break it to get this exact error in any way. Is there a chance that you could provide some more info how to reproduce this?

@NicHaley
Copy link
Author

NicHaley commented Jun 10, 2020

We were only getting these errors in production, hard to say why. I have a suspicion that it occurs when another (unrelated) exception is thrown. Have you tried throwing other exceptions? When I have some time I can try spinning up and dummy project and reproducing as well.

@matwa13
Copy link

matwa13 commented Jun 15, 2020

I have the same issue
Simplified code looks like this:

import {
  Hub,
  BrowserClient,
  defaultIntegrations
} from '@sentry/browser';

const client = new BrowserClient({
  dsn: 'dsn',
  integrations: defaultIntegrations
});

client.setupIntegrations();
const  hub = new Hub(client);

hub.run(currentHub => {
  currentHub.configureScope((scope) => {
    if (message) {
      scope.setTag('message', message);
    }
    currentHub.captureException(error);
  });
});

https://sentry.io/organizations/brilliant-home-technology/issues/1722024880/?project=1550464&query=is%3Aunresolved+_mergeOptions&statsPeriod=14d

@kamilogorek
Copy link
Contributor

I tried every random idea to break it and I wasn't able to.

Gibberish code below, don't analyze it.

import * as Sentry from "@sentry/browser";
import { Hub, BrowserClient, defaultIntegrations } from "@sentry/browser";

Sentry.init({
  dsn: "http://[email protected]/123"
});

const client = new BrowserClient({
  dsn: "http://[email protected]/123",
  integrations: defaultIntegrations
});

const client2 = new BrowserClient({
  dsn: "http://[email protected]/123"
});

const hub = new Hub(client);
const hub2 = new Hub(client2);

const message = "wat";
const error = new Error("as");

setTimeout(() => {
  throw new Error("wat");
  Sentry.captureException(new Error("wat"));
  Sentry.captureMessage("ok");
});

Sentry.captureException(new Error("wat"));
Sentry.captureMessage("ok");

hub.captureException(error);

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

  Sentry.captureException(new Error("wat"));
  Sentry.captureMessage("ok");

  currentHub.configureScope(scope => {
    currentHub.captureException(error);
    if (message) {
      scope.setTag("message", message);
    }
    currentHub.captureException(error);
    setTimeout(() => {
      throw new Error("wat");
    });
    Sentry.captureException(new Error("wat"));
    Sentry.captureMessage("ok");
  });

  setTimeout(() => {
    throw new Error("wat");
  });

  hub.run(currentHub => {
    Sentry.captureException(new Error("wat"));
    Sentry.captureMessage("ok");
    currentHub.captureException(error);
    currentHub.configureScope(scope => {
      currentHub.captureException(error);
      if (message) {
        scope.setTag("message", message);
      }
      currentHub.captureException(error);
      setTimeout(() => {
        throw new Error("wat");
      });
    });
    setTimeout(() => {
      throw new Error("wat");
    });
  });

  hub2.run(currentHub => {
    currentHub.captureException(error);
    currentHub.configureScope(scope => {
      currentHub.captureException(error);
      if (message) {
        scope.setTag("message", message);
      }
      currentHub.captureException(error);
      setTimeout(() => {
        throw new Error("wat");
      });
    });
    setTimeout(() => {
      throw new Error("wat");
    });
  });
});

hub2.run(currentHub => {
  currentHub.captureException(error);

  currentHub.configureScope(scope => {
    currentHub.captureException(error);
    if (message) {
      scope.setTag("message", message);
    }
    currentHub.captureException(error);
    setTimeout(() => {
      throw new Error("wat");
    });
  });
});

Unfortunately, it's very hard to even start debugging when I'm not able to break it.
@matwa13 I also analyzed your sourcecode bundle that was used in the event that you linked and it looks "just fine" ¯_(ツ)_/¯

@zetaab
Copy link

zetaab commented Jun 24, 2020

Screenshot 2020-06-24 at 13 03 44

I think I am seeing this same issue

I have added following snippet to our html page:

    <script
      src="https://browser.sentry-cdn.com/5.18.0/bundle.min.js"
      integrity="sha384-9M0M/t9hmfACAyfoyFXXyzRbljCren5OjRJhHwZHJzuzFt02ZB67XZO27O1tml6L"
      crossorigin="anonymous"></script>
    <script>
        (function () {
            'use strict';
            Sentry.init({ dsn: 'https://xxxx' });
            window.onerror = function(msg, url, lineNo, columnNo, error) {
                console.log(msg, url, lineNo, columnNo, error);
                Sentry.captureException(error);
            }
        })();
    </script>

and it leads to row:
Screenshot 2020-06-24 at 13 04 50

this issue does not happen in each request, so this might be browser related (some users using old browsers).

@jackric
Copy link

jackric commented Aug 3, 2020

@NicHaley have you resolved for your organization? We're hitting the same.

@NicHaley
Copy link
Author

NicHaley commented Aug 4, 2020

@jackric We have not unfortunately. We have had to abandon this use-case for now.

@olliastley
Copy link

Hi, we have the issue on our live site at present, has anyone looked into the issue more?

@EternallLight
Copy link

Hey, I've been trying to add Sentry to a React application according to the instructions, and still get this self._mergeOptions / e.wt is not a function logged instead. Any ideas?

@nicklaw5
Copy link

nicklaw5 commented Sep 20, 2020

I am also seeing this when attempting to integrate with Vue.js.

Vue version: 2.6.12
Sentry version: 5.24.2

import Vue from 'vue'
import * as Sentry from '@sentry/browser'
import { Vue as VueIntegration } from '@sentry/integrations'

Sentry.init({
  dsn: '<redacted>',
  release: '<redacted>',
  environment: 'local',
  integrations: [new VueIntegration({ Vue, attachProps: true, logErrors: true })],
})

Full stack trace:

TypeError: e.wt is not a function
  at processor(../../core/src/integrations/inboundfilters.ts:49:30)
  at executor(../../hub/src/scope.ts:367:24)
  at new t(../../utils/src/syncpromise.ts:34:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:362:12)
  at t.applyToEvent(../../hub/src/scope.ts:350:17)
  at e.t._prepareEvent(/assets/js/entry/profile.a55fe8ab.js:50:150790)
  at e._prepareEvent(/assets/js/entry/profile.a55fe8ab.js:50:176784)
  at ? (/assets/js/entry/profile.a55fe8ab.js:50:152399)
  at new t(/assets/js/entry/profile.a55fe8ab.js:50:131063)
  at e.t._processEvent(/assets/js/entry/profile.a55fe8ab.js:50:152376)
  at e.t.captureEvent(/assets/js/entry/profile.a55fe8ab.js:50:149172)
  at ? (/assets/js/entry/profile.a55fe8ab.js:50:148793)
  at Object.onfulfilled(/assets/js/entry/profile.a55fe8ab.js:50:131666)
  at ? (/assets/js/entry/profile.a55fe8ab.js:50:130961)
  at Array.forEach(<anonymous>)
  at t._executeHandlers(/assets/js/entry/profile.a55fe8ab.js:50:130891)
  at t._attachHandler(/assets/js/entry/profile.a55fe8ab.js:50:130770)
  at ? (/assets/js/entry/profile.a55fe8ab.js:50:131595)
  at new t(/assets/js/entry/profile.a55fe8ab.js:50:131063)
  at t.then(/assets/js/entry/profile.a55fe8ab.js:50:131572)
  at e.t.captureException(/assets/js/entry/profile.a55fe8ab.js:50:148771)
  at _invokeClient(../../hub/src/hub.ts:395:27)
  at t.captureException(../../hub/src/hub.ts:170:10)
  at ft(/assets/js/entry/profile.a55fe8ab.js:50:165541)
  at dt(/assets/js/entry/profile.a55fe8ab.js:50:165752)
  at ? (/assets/js/entry/profile.a55fe8ab.js:50:188832)
  at t.withScope(../../hub/src/hub.ts:117:7)
  at ft(/assets/js/entry/profile.a55fe8ab.js:50:165541)
  at ht(/assets/js/entry/profile.a55fe8ab.js:50:165852)
  at oe(/assets/js/entry/profile.a55fe8ab.js:50:188801)
  at a.getTypeNameById(/assets/js/entry/profile.a55fe8ab.js:26:43655)
  at a.formatFilter(/assets/js/entry/profile.a55fe8ab.js:26:43532)
  at ? (/assets/js/entry/profile.a55fe8ab.js:26:40559)
  at a.be [as _l](/assets/js/entry/profile.a55fe8ab.js:72:15993)
  at a.T(/assets/js/entry/profile.a55fe8ab.js:26:40442)
  at a.t._render(/assets/js/entry/profile.a55fe8ab.js:72:35314)
  at a.r(/assets/js/entry/profile.a55fe8ab.js:72:68190)
  at hn.get(/assets/js/entry/profile.a55fe8ab.js:72:26678)
  at hn.run(/assets/js/entry/profile.a55fe8ab.js:72:27562)
  at fn(/assets/js/entry/profile.a55fe8ab.js:72:25670)
  at Array.<anonymous>(/assets/js/entry/profile.a55fe8ab.js:72:12361)
  at Zt(/assets/js/entry/profile.a55fe8ab.js:72:11804)

@footrial
Copy link

footrial commented Sep 20, 2020

We also have the same problem on our site:

Vue version: 2.6.10
Sentry version: 5.22.3

import Vue from 'vue';
import * as Sentry from "@sentry/browser";
import { Vue as VueIntegration } from '@sentry/integrations';
TypeError: e.wt is not a function
  at processor(../../core/src/integrations/inboundfilters.ts:49:30)
  at executor(../../hub/src/scope.ts:367:24)
  at new t(../../utils/src/syncpromise.ts:34:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:362:12)
  at applyToEvent(../../hub/src/scope.ts:350:17)
  at call(./node_modules/@sentry/core/esm/baseclient.js:229:33)
  at _prepareEvent(./node_modules/@sentry/browser/esm/client.js:54:47)
  at executor(./node_modules/@sentry/core/esm/baseclient.js:351:19)
  at new t(./node_modules/@sentry/utils/esm/syncpromise.js:78:13)
  at _processEvent(./node_modules/@sentry/core/esm/baseclient.js:350:16)
  at method(./node_modules/@sentry/core/esm/baseclient.js:95:14)
  at _invokeClient(../../hub/src/hub.ts:394:27)
  at captureEvent(../../hub/src/hub.ts:212:10)
  at handler(./node_modules/@sentry/browser/esm/integrations/globalhandlers.js:118:28)
  at triggerHandlers(./node_modules/@sentry/utils/esm/instrument.js:75:17)
  at Oo.Co.onunhandledrejection(./node_modules/@sentry/utils/esm/instrument.js:462:9)

I figure out that sometimes on reported bug in sentry we have two events with the same timestamp, one with correct entry:

ErrorException: Trying to get property 'current_subscription' of non-object
#75 /app/Services/OrderService.php(280): Illuminate\Foundation\Bootstrap\HandleExceptions::handleError
#74 /app/Services/OrderService.php(280): App\Services\OrderService::isSubscriptionUpgrade
#73 /app/Http/Resources/Order.php(80): App\Http\Resources\Order::resolveStartDate
#72 /app/Http/Resources/Order.php(35): App\Http\Resources\Order::toArray
#71 /vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(60): Illuminate\Support\HigherOrderCollectionProxy::Illuminate\Support\{closure}
#70 [internal](0): array_map
#69 /vendor/laravel/framework/src/Illuminate/Support/Collection.php(1120): Illuminate\Support\Collection::map
#68 /vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(61): Illuminate\Support\HigherOrderCollectionProxy::__call
#67 /vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceCollection.php(59): Illuminate\Http\Resources\Json\ResourceCollection::toArray
#66 /app/Http/Resources/OrderCollection.php(18): App\Http\Resources\OrderCollection::toArray
#65 /vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php(94): Illuminate\Http\Resources\Json\JsonResource::resolve
#64 /vendor/laravel/framework/src/Illuminate/Http/Resources/Json/PaginatedResourceResponse.php(19): Illuminate\Http\Resources\Json\PaginatedResourceResponse::toResponse
#63 /vendor/laravel/framework/src/Illuminate/Http/Resources/Json/ResourceCollection.php(71): Illuminate\Http\Resources\Json\ResourceCollection::toResponse
#62 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(733): Illuminate\Routing\Router::toResponse
#61 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(720): Illuminate\Routing\Router::prepareResponse
#60 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\Routing\Router::Illuminate\Routing\{closure}
#59 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#58 /vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php(45): Illuminate\Auth\Middleware\Authorize::handle
#57 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#56 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#55 /vendor/spatie/laravel-permission/src/Middlewares/RoleMiddleware.php(25): Spatie\Permission\Middlewares\RoleMiddleware::handle
#54 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#53 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#52 /app/Http/Middleware/SentryMiddleware.php(34): App\Http\Middleware\SentryMiddleware::handle
#51 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#50 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#49 /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Middleware\SubstituteBindings::handle
#48 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#47 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#46 /vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Auth\Middleware\Authenticate::handle
#45 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#44 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#43 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::handle
#42 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#41 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#40 /vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\View\Middleware\ShareErrorsFromSession::handle
#39 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#38 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#37 /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Session\Middleware\StartSession::handle
#36 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#35 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#34 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::handle
#33 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#32 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#31 /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Cookie\Middleware\EncryptCookies::handle
#30 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#29 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#28 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline::then
#27 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(682): Illuminate\Routing\Router::runRouteWithinStack
#26 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(657): Illuminate\Routing\Router::runRoute
#25 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\Routing\Router::dispatchToRoute
#24 /vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\Routing\Router::dispatch
#23 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Foundation\Http\Kernel::Illuminate\Foundation\Http\{closure}
#22 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#21 /vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Barryvdh\Debugbar\Middleware\InjectDebugbar::handle
#20 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#19 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#18 /vendor/fideloper/proxy/src/TrustProxies.php(57): Fideloper\Proxy\TrustProxies::handle
#17 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#16 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#15 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Foundation\Http\Middleware\TransformsRequest::handle
#14 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#13 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#12 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Foundation\Http\Middleware\TransformsRequest::handle
#11 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#10 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#9 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Foundation\Http\Middleware\ValidatePostSize::handle
#8 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#7 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#6 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::handle
#5 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
#4 /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Pipeline::Illuminate\Routing\{closure}
#3 /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Pipeline\Pipeline::then
#2 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Foundation\Http\Kernel::sendRequestThroughRouter
#1 /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel::handle
#0 /public/index.php(55): null

and second with this bug:

TypeError: e.wt is not a function
  at processor(../../core/src/integrations/inboundfilters.ts:49:30)
  at executor(../../hub/src/scope.ts:367:24)
  at new t(../../utils/src/syncpromise.ts:34:7)
  at _notifyEventProcessors(../../hub/src/scope.ts:362:12)
  at applyToEvent(../../hub/src/scope.ts:350:17)
  at call(./node_modules/@sentry/core/esm/baseclient.js:229:33)
  at _prepareEvent(./node_modules/@sentry/browser/esm/client.js:54:47)
  at executor(./node_modules/@sentry/core/esm/baseclient.js:351:19)
  at new t(./node_modules/@sentry/utils/esm/syncpromise.js:78:13)
  at _processEvent(./node_modules/@sentry/core/esm/baseclient.js:350:16)
  at method(./node_modules/@sentry/core/esm/baseclient.js:95:14)
  at _invokeClient(../../hub/src/hub.ts:394:27)
  at captureEvent(../../hub/src/hub.ts:212:10)
  at handler(../src/integrations/globalhandlers.ts:168:20)
  at triggerHandlers(../../utils/src/instrument.ts:100:7)
  at apply(../../utils/src/instrument.ts:539:5)
  at Mo.onunhandledrejection(./node_modules/@sentry/utils/esm/instrument.js:465:52)

@nicklaw5
Copy link

I managed to resolve my issue above. I ended up having multiple calls to Sentry.init(...) in the same page load. After I removed the duplicate call, everything worked as expected.

@EternallLight
Copy link

As for me, the issue was gone once I unchecked the "Disable cache" button in the developer tools. The interesting fact is that with that checkbox on I randomly received one of the following outcomes:

  • e.wt is not a function
  • _mergeOptions is not a function
  • everything worked ok

It feels like there was a race condition while loading sourcemaps or something.

@EternallLight
Copy link

EternallLight commented Sep 21, 2020

Still randomly having these errors.

image

I'm wondering how https://browser.sentry-cdn.com/5.20.1/bundle.min.js even got into stacktrace? It doesn't get loaded and I'm using the latest version of the package.

@jackric
Copy link

jackric commented Sep 21, 2020

I resolved my issue - my code (with Sentry client) was loading onto a page that had another app loaded using Sentry.
The trick is to keep your Sentry calls scoped to your app, and your own Hub. The meat of the solution is below, note the usage of sentry.run:

const client = new Sentry.BrowserClient({
  dsn,
  integrations: Sentry.defaultIntegrations,
  environment: IS_LOCALHOST ? "localhost" : "prod",
  release: RELEASE_STRING
});

const sentry = new Hub(client);

sentry.configureScope(scope => scope.setTag("userAgent", window.navigator.userAgent));

export const sentryErrorHandler = (error: Error, componentStack?: string) => {
  console.log("Sentry captured error", error);
  sentry.run(currentHub => {
    currentHub.captureException(error);
  });
};

I import and use this custom sentryErrorHandler in my app.

@some1else
Copy link

Seeing a spike of these errors today.

TypeError: r._mergeOptions is not a function
  at processor(../../../src/integrations/inboundfilters.ts:49:30)
  at executor(../../src/scope.ts:367:24)
  at new e(../../src/syncpromise.ts:34:7)
  at _notifyEventProcessors(../../src/scope.ts:362:12)
  at applyToEvent(../../src/scope.ts:350:17)
  at _prepareEvent(../../core/src/baseclient.ts:279:27)
  at _prepareEvent(../src/client.ts:67:18)
  at executor(../../core/src/baseclient.ts:425:12)
  at new t(../../utils/src/syncpromise.ts:34:7)
  at _processEvent(../../core/src/baseclient.ts:424:12)
  at n.t.captureEvent(../../core/src/baseclient.ts:130:10)
  at _invokeClient(../../src/hub.ts:394:34)
  at captureEvent(../../src/hub.ts:212:10)
  at handler(../../../src/integrations/globalhandlers.ts:168:20)
  at triggerHandlers(../../src/instrument.ts:100:7)
  at apply(../../src/instrument.ts:539:5)
  at ft.onunhandledrejection(../../utils/src/instrument.ts:543:46)

@jackric
Copy link

jackric commented Sep 22, 2020

@some1else are 2 Sentry instances running on the page? From my experience either a 2nd Sentry instance was added or you had 2 already and now a new error in the app is tripping this bug. See my comment above for a workaround.

@EternallLight
Copy link

To sum it up, yes, I also had two Sentry instances on the page. In my case, Sentry integration was also added via Google Tag Manager, and it added Sentry script from CDN. When I removed local Sentry and started using the one from GTM, these errors were gone. Hope, some day we will have a more comprehensive error message.

@kamilogorek
Copy link
Contributor

kamilogorek commented Sep 29, 2020

I'd still love to fix this issue, but no matter what I try, I cannot reproduce this locally in any way. If someone is able to provide repro, I'll definitely take care of it.

@carlos-algms
Copy link

For me, it was happening when using sentry-webpack and sentry-browser with different versions.
I think at some point the private members were renamed between _mergeOptions and mergeOptions.

@some1else
Copy link

Conflict between React integration and Tag Manager inserted CDN version here as well.

@kamilogorek
Copy link
Contributor

@carlos-algms true, it was done in March. 2019 😅 But still, it should be contained within the class itself, so references should still work correctly.

@carlos-algms
Copy link

@kamilogorek It is way more complex than just references.
To avoid events duplication, Sentry hooks on Globals and overrides some browser APIs when it initializes.
So if your reference is different from the events bound, it will crash because the "plugins" on your instance does not contain the required methods, in this case, _mergeOptions, because it was renamed.

@kamilogorek
Copy link
Contributor

kamilogorek commented Sep 29, 2020

That is correct, it'll go through the global hub first, but it was very hard to believe for me that it could still clash somehow, as these versions are so far apart. Good to know that some 3rd party plugins are still using such an old version though.

So a tl;dr for anyone reading this thread as of now is: make sure that you are not running 2 separate instances of Sentry SDK (unless you are using client directly), and if you do, verify that both SDKs are running at least 5.0.0 release.

@kilobyte2007
Copy link

In our case, it was caused by the fact that our client was using Sentry on his site, while we were using Sentry in our bundle (our customers have to include a code snippet to their site like you would do go google analytics). And because the customer's version has had the InboundFilters integration and our did not, it threw an error. We had to add the InboundFilter to our own Sentry instance integration to fix this.

@brianhwitte
Copy link

We are getting the r._mergeOptions is not a function error as well. We have an older site that uses mostly jquery 2.2 on the front end, but we also have a few pages that use Vue.js (trying for a gradual transition to a more modern front end).

We have a base.html with the basic sentry JS version 6.x loaded and initiated as such:

<script src="https://js.sentry-cdn.com/<js-specific dsn>.min.js" crossorigin="anonymous" data-lazy="no"></script>
            <script>
                Sentry.onLoad(function() {
                    Sentry.init({
                        environment: "{{ settings.SITE_NAME }}"
                    })
                })
</script>

On the page using Vue.js (v. 2.6.11), in the main.js:

import Vue from "vue";
import vueCustomElement from 'vue-custom-element';
import * as Sentry from "@sentry/vue";
import { Integrations } from "@sentry/tracing";

Vue.use(vueCustomElement);

Sentry.init({
    Vue,
    dsn:  "https://<vue-specific dsn>@o13384.ingest.sentry.io/5723698",
    integrations: [new Integrations.BrowserTracing()],
    tracesSampleRate: 1.0,
    tracingOptions: {
        trackComponents: true,
    },
});

Is there a way to add Vue integration to the Sentry init in base.html header?

@kamilogorek
Copy link
Contributor

Tbh I'm not sure why you are trying to use lazy-loaded SDK, but then call Sentry.init inside your main function as well. I'd not use lazy-loader here tbh, as you are trying to use performance (which depends on SDK being loaded as early as possible) and you need Vue instance to initialize it anyway.

@brianhwitte
Copy link

@kamilogorek Vue is being used as a component on a subset of pages for the overall site. Most of the site is a static & RESTful with a bit of jQuery for DOM manipulation. The data-lazy="no" is to allow breadcrumb capture and additional context around errors. I based it on this: https://docs.sentry.io/platforms/javascript/install/lazy-load-sentry/#sdk-configuration.

The pages with Vue look something like this:

<base.html (with sentry js loaded in header)>

<vue used to manage a dynamic table, with @sentry/vue>

@nmackey
Copy link

nmackey commented Dec 22, 2021

I'm running into this error with my app. My app is a 3rd party app loaded by pages that I don't control so my guess is that some of these pages are loading Sentry as well. I am already using a version that includes @kamilogorek fix above however most of my sentry error reports seem to be this problem related to _mergeOptions. Is there a recommendation on how to deal with this?

Couple of follow up questions:
When this error happens does this prevent sentry from reporting additional errors?
Should I just filter out this error using the Inbound Filters in Sentry?

@matheusgoc
Copy link

I'm getting this issue on React. I'm just following the basic directions at Sentry React docs here https://docs.sentry.io/platforms/javascript/guides/react. Is there anyone would faced it at React? It's getting hard to sort this out.

@igorsantos07
Copy link

igorsantos07 commented Feb 22, 2023

Same issue here, trying to run a React application with Sentry, inside a Cordova shell also with Sentry. This is a real blocker, since one of the reasons we went with Sentry was the number of platforms supported - and since our app runs both on browsers and "native" (through Cordova), we can't really choose one or the other.

@kamilogorek, I wonder if you saw the comment from nmackey from a year or so ago? I'm never sure if closed issues here in GH still notify their owners...

I'm running Sentry React 7.38.0 and Sentry Cordova 1.0.4 (should I report it to these other repos instead? Not sure how similar is Cordova's with the base JS SDK).

@kamilogorek
Copy link
Contributor

cc @getsentry/team-web-sdk-frontend

@igorsantos07
Copy link

@kamilogorek sorry to bother you again, but is there any person we could bring in? Should I try a support ticket instead? Open a new issue?

Thanks for any guidance!

@lforst
Copy link
Contributor

lforst commented Mar 8, 2023

You need to make sure all your Sentry dependencies have matched versions. If you grep for "sentry" in your lockfile and share it here I can tell you what version to pin your deps to.

@lforst
Copy link
Contributor

lforst commented Mar 8, 2023

Actually, just make sure your sentry dependencies align with the dependencies defined in the cordova sdk:

"@sentry/browser": "7.34.0",
"@sentry/core": "7.34.0",
"@sentry/hub": "7.34.0",
"@sentry/types": "7.34.0",
"@sentry/utils": "7.34.0",

@igorsantos07
Copy link

igorsantos07 commented Mar 10, 2023

Aha! THAT makes sense now! I was confused since sentry-cordova doesn't have the same version numbers, but I didn't think about checking if the packages had common dependencies. Will try this in the following days and report back. Thanks @lforst and Kamilo!

EDIT - doesn't seem to solve the issue. See linked issue below.

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

Successfully merging a pull request may close this issue.