sentry-javascript: Node.js 12 "Cannot read property 'enter' of undefined"
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account => there’s no Sentry event because the error lies in Sentry code I believe
Package + Version
-
@sentry/node -
@sentry/integrations
Version:
@sentry/node 5.3.0
@sentry/integrations 5.3.1
Node.js 12.3.1
Description
After switching to Node 12.3.1 I started to have hard crashes of my application this way:
TypeError: Cannot read property 'enter' of undefined
at AsyncHook.before (domain.js:76:20)
at emitHook (internal/async_hooks.js:164:38)
Here’s how we use Sentry (relevant lines only):
const express = require('express');
const app = express();
const Sentry = require('@sentry/node');
const SentryIntegrations = require('@sentry/integrations');
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.APP_ENV,
release: `support@${process.env.HEROKU_RELEASE_VERSION}`,
integrations: [
new SentryIntegrations.ExtraErrorData(),
new SentryIntegrations.Transaction(),
],
});
app.use(Sentry.Handlers.requestHandler());
app.use(Sentry.Handlers.errorHandler());
module.exports = app;
After checking our code I believe the only places where Node.js domains are used are Sentry code. This is why I am opening this issue.
Recent changes to async_handlers linked to domains: https://github.com/nodejs/node/commit/04355eff5bc604cb639f91d159ce21971e2c3bb4#commitcomment-33702918
Let me know if you need anything else.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 43 (7 by maintainers)
fyi @vvo @BYK @kamilogorek @emhagman @kunal15595 - I came across your issue here as I had the exact same error show up in my hapi servers (no sentry) with node > 12.2.
I believe it was caused by https://github.com/nodejs/node/issues/28275. The fix for that issue was merged 5 days ago with https://github.com/nodejs/node/commit/43e5478e2f51343b66f4d243bb4800d8e422f764 and hopefully will be released soon and resolve our issue.
@emhagman Yep same for me, 12.10 is triggering it too.
Just experienced this same issue in 12.10 which came out on September 3rd. Not sure this is fixed.
Scheduled for today: https://github.com/nodejs/node/pull/31069
For everyone here, the fix has landed in here https://github.com/nodejs/node/commit/d26a74dca0d04a827140a33a43c38a55f12c7296
It should be released into 13.x soon and then two weeks later into 12.x so keep any eye out
I’ve posted a bug report on the NodeJS repo. Hopefully, someone has some insight as to why it might be happening https://github.com/nodejs/node/issues/30122
For anyone curious, this landed in 12.8.0: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#2019-08-06-version-1280-current-bridgear
https://github.com/nodejs/node/commit/727ffe4720
I’ve also encountered this issue upon upgrading to NodeJS 12.6.0
Getting this on node v12.6.0, sentry v5.5.0 fixed by reverting to v12.2.0