Skip to content

Node.js 12 "Cannot read property 'enter' of undefined" #2089

@vvo

Description

@vvo

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: nodejs/node@04355ef#commitcomment-33702918

Let me know if you need anything else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions