Closed domkck closed 4 years ago
Detected the same issue on @sentry/node 5.15.5. Downgraded to 5.15.4 as a workaround. Now tried the latest @sentry/node 5.17.0. Works Ok for me.
There was no changes done to node package between 5.15.4
and 5.15.5
. I wonder what was the issue.
Also getting this with sentry/node 5.18.1:
TypeError: self.handler is not a function
at None (/home/node/node_modules/@sentry/node/dist/integrations/linkederrors.js:29:29)
at None (/home/node/node_modules/@sentry/hub/dist/scope.js:69:30)
at new SyncPromise (/home/node/node_modules/@sentry/utils/dist/syncpromise.js:74:13)
at Scope._notifyEventProcessors (/home/node/node_modules/@sentry/hub/dist/scope.js:62:16)
at None (/home/node/node_modules/@sentry/hub/dist/scope.js:76:27)
There was no changes done to node package between
5.15.4
and5.15.5
. I wonder what was the issue.
Looks like @sentry/node
depends on @sentry/apm
, and @sentry/apm
depends on @sentry/browser
. And the issue actually is in @sentry/browser
. In my case wrong data in Sentry was marked as sent by
node_modules\@sentry\browser\dist\integrations\linkederrors.js in null.
at line 30:29 SDK: sentry.javascript.node | 5.15.5
Can confirm the crash is still present in 5.19.1
. Full stack trace:
TypeError: self._handler is not a function
File "/app/node_modules/@sentry/browser/dist/integrations/linkederrors.js", line 30, col 29, in null.<anonymous>
return self._handler(event, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 69, col 30, in null.<anonymous>
var result = processor(tslib_1.__assign({}, event), hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 76, col 27, in null.<anonymous>
_this._notifyEventProcessors(processors, result, hint, index + 1)
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 72, col 63, in null.<anonymous>
.then(function (final) { return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve); })
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 47, col 19, in SyncPromise._attachHandler
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 127, col 19, in null.<anonymous>
_this._attachHandler({
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 126, col 16, in SyncPromise.then
return new SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 72, col 26, in null.<anonymous>
.then(function (final) { return _this._notifyEventProcessors(processors, final, hint, index + 1).then(resolve); })
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 76, col 27, in null.<anonymous>
_this._notifyEventProcessors(processors, result, hint, index + 1)
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 344, col 21, in Scope.applyToEvent
return this._notifyEventProcessors(tslib_1.__spread(getGlobalEventProcessors(), this._eventProcessors), event, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 226, col 33, in NodeClient.BaseClient._prepareEvent
result = finalScope.applyToEvent(prepared, hint);
File "/app/node_modules/@sentry/node/dist/client.js", line 35, col 47, in NodeClient._prepareEvent
return _super.prototype._prepareEvent.call(this, event, scope, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 348, col 19, in null.<anonymous>
_this._prepareEvent(event, scope, hint)
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 347, col 16, in NodeClient.BaseClient._processEvent
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 92, col 14, in NodeClient.BaseClient.captureEvent
this._processEvent(event, hint, scope)
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 66, col 29, in null.<anonymous>
eventId = _this.captureEvent(event, hint, scope);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 47, col 19, in SyncPromise._attachHandler
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 127, col 19, in null.<anonymous>
_this._attachHandler({
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 126, col 16, in SyncPromise.then
return new SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 65, col 14, in NodeClient.BaseClient.captureException
.then(function (event) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/hub.js", line 59, col 39, in Hub._invokeClient
(_a = top.client)[method].apply(_a, tslib_1.__spread(args, [top.scope]));
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/hub.js", line 151, col 14, in Hub.captureException
this._invokeClient('captureException', exception, tslib_1.__assign({}, finalHint, { event_id: eventId }));
File "/app/node_modules/@sentry/node/node_modules/@sentry/minimal/dist/index.js", line 17, col 28, in callOnHub
return hub[method].apply(hub, tslib_1.__spread(args));
File "/app/node_modules/@sentry/node/node_modules/@sentry/minimal/dist/index.js", line 35, col 12, in Object.captureException
return callOnHub('captureException', exception, {
File "/app/node_modules/@sentry/node/dist/handlers.js", line 269, col 38, in null.<anonymous>
var eventId = core_1.captureException(error);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/hub.js", line 104, col 13, in Hub.withScope
callback(scope);
File "/app/node_modules/@sentry/node/node_modules/@sentry/minimal/dist/index.js", line 17, col 28, in callOnHub
return hub[method].apply(hub, tslib_1.__spread(args));
File "/app/node_modules/@sentry/node/node_modules/@sentry/minimal/dist/index.js", line 160, col 5, in Object.withScope
callOnHub('withScope', callback);
File "/app/node_modules/@sentry/node/dist/handlers.js", line 268, col 20, in sentryErrorMiddleware
core_1.withScope(function (_scope) {
File "/app/node_modules/express-async-errors/index.js", line 16, col 20, in newFn
const ret = fn.apply(this, args);
File "/app/node_modules/elastic-apm-node/lib/instrumentation/modules/express.js", line 67, col 25, in handle
return orig.apply(this, arguments)
Another stack trace:
TypeError: self.handler is not a function
File "/app/node_modules/@sentry/node/dist/integrations/linkederrors.js", line 29, col 29, in null.<anonymous>
return self.handler(event, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 69, col 30, in null.<anonymous>
var result = processor(tslib_1.__assign({}, event), hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 76, col 27, in null.<anonymous>
_this._notifyEventProcessors(processors, result, hint, index + 1)
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 62, col 16, in Scope._notifyEventProcessors
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/hub/dist/scope.js", line 344, col 21, in Scope.applyToEvent
return this._notifyEventProcessors(tslib_1.__spread(getGlobalEventProcessors(), this._eventProcessors), event, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 226, col 33, in NodeClient.BaseClient._prepareEvent
result = finalScope.applyToEvent(prepared, hint);
File "/app/node_modules/@sentry/node/dist/client.js", line 35, col 47, in NodeClient._prepareEvent
return _super.prototype._prepareEvent.call(this, event, scope, hint);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 348, col 19, in null.<anonymous>
_this._prepareEvent(event, scope, hint)
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 74, col 13, in new SyncPromise
executor(this._resolve, this._reject);
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 347, col 16, in NodeClient.BaseClient._processEvent
return new utils_1.SyncPromise(function (resolve, reject) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 92, col 14, in NodeClient.BaseClient.captureEvent
this._processEvent(event, hint, scope)
File "/app/node_modules/@sentry/node/node_modules/@sentry/core/dist/baseclient.js", line 66, col 29, in null.<anonymous>
eventId = _this.captureEvent(event, hint, scope);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 41, col 19, in SyncPromise._setResult
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 24, col 19, in SyncPromise._resolve
_this._setResult(States.RESOLVED, value);
File "/app/node_modules/@sentry/node/dist/backend.js", line 68, col 17, in null.<anonymous>
resolve(tslib_1.__assign({}, event, { event_id: hint && hint.event_id }));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 41, col 19, in SyncPromise._setResult
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 24, col 19, in SyncPromise._resolve
_this._setResult(States.RESOLVED, value);
File "/app/node_modules/@sentry/node/dist/parsers.js", line 216, col 13, in null.<anonymous>
resolve({
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 41, col 19, in SyncPromise._setResult
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 24, col 19, in SyncPromise._resolve
_this._setResult(States.RESOLVED, value);
File "/app/node_modules/@sentry/node/dist/parsers.js", line 205, col 13, in null.<anonymous>
resolve(result);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 41, col 19, in SyncPromise._setResult
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 24, col 19, in SyncPromise._resolve
_this._setResult(States.RESOLVED, value);
File "/app/node_modules/@sentry/node/dist/parsers.js", line 186, col 13, in null.<anonymous>
resolve(result);
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 137, col 33, in Object.onfulfilled
resolve(onfulfilled(result));
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 62, col 33, in null.<anonymous>
handler.onfulfilled(_this._value);
?, in Array.forEach
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 56, col 28, in SyncPromise._executeHandlers
cachedHandlers.forEach(function (handler) {
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 41, col 19, in SyncPromise._setResult
_this._executeHandlers();
File "/app/node_modules/@sentry/node/node_modules/@sentry/utils/dist/syncpromise.js", line 24, col 19, in SyncPromise._resolve
_this._setResult(States.RESOLVED, value);
File "/app/node_modules/@sentry/node/dist/parsers.js", line 97, col 21, in null.<anonymous>
resolve(sourceFiles);
It seems that this happens whenever Sentry tries to log an error, and then this appears in Sentry instead of the actual error.
Have recently installed 7.8.0 from 6.16.1 and this issue seems to have returned. Seeing identical behaviour to that described in this thread.
It looks like this commit re-introduced the problem perhaps? https://github.com/getsentry/sentry-javascript/commit/4077204fe7ad193e5e10b730c0d74c4277c85808#diff-e61f0c3774e88d33bd71fe7da37672a7702f0859aaa3d0a65b5f543b7af778daL48
The specific stack trace we get is
self._handler is not a function
/app/node_modules/@sentry/node/cjs/integrations/linkederrors.js in <anonymous> at line 54:20
/app/node_modules/@sentry/src/scope.ts in <anonymous> at line 515:1
/app/node_modules/@sentry/src/syncpromise.ts in new SyncPromise at line 58:1
/app/node_modules/@sentry/src/scope.ts in Scope._notifyEventProcessors at line 510:1
/app/node_modules/@sentry/src/scope.ts in <anonymous> at line 524:1
/app/node_modules/@sentry/node/cjs/integrations/linkederrors.js in runMicrotasks
node:internal/process/task_queues in processTicksAndRejections at line 96:5
Event ID 909bd2cdaca24b1ea6e44daa121f1dc0
for an example.
Package + Version
@sentry/browser
@sentry/node
raven-js
raven-node
(raven for node)Version:
Description
When using the Express error handler (
Sentry.Handlers.errorHandler()
) and throwing an error inside a route, it doesn't get captured by Sentry, instead a crash inside the library appears.Downgrading to
5.14.2
fixes it and the exception appears in Sentry as expected.Event ID
60a596ee9f9848299273f60b8fb524ef
to see an example.