Skip to content

ANR error if Node is run with --inspect #10024

Description

@joshkel

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.91.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

import * as Sentry from '@sentry/node';

function configureSentry(
) {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    integrations: [new Sentry.Integrations.Anr({captureStackTrace: true})],
  });
}

Steps to Reproduce

import * as Sentry from '@sentry/node';

function configureSentry(
) {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    integrations: [new Sentry.Integrations.Anr({captureStackTrace: true})],
  });
}

async function main() {
  configureSentry();
  await new Promise(resolve => setTimeout(resolve, 1000));
  process.exit(0);
}

main();
node --inspect test.mjs

Expected Result

Successful run.

Actual Result

The following error is thrown:

Debugger listening on ws://127.0.0.1:9229/ab2cd6ad-150d-4643-ad5c-8345dd412d13
For help, see: https://nodejs.org/en/docs/inspector
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error [ERR_INSPECTOR_ALREADY_ACTIVATED]: Inspector is already activated. Close it with inspector.close() before activating it again.
    at new NodeError (node:internal/errors:405:5)
    at Object.inspectorOpen [as open] (node:inspector:172:11)
    at Anr._startWorker (/Users/josh/tmp/node_modules/@sentry/node/cjs/integrations/anr/index.js:105:17)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions