Skip to content

Error [ERR_INSPECTOR_NOT_AVAILABLE] in ANR module when using vercel/pkg #9146

Closed
@zolbooo

Description

@zolbooo

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.72.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

import * as Sentry from "@sentry/node";
import { GraphQLError } from "graphql";
if (process.env.NODE_ENV !== "test" && process.env.NODE_ENV !== "development") {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    environment: process.env.NODE_ENV,
    beforeSend(event, hint) {
      const error = hint.originalException;
      if (error instanceof GraphQLError) {
        if (
          ["EXAMPLE_ERROR_CODE"].includes((error.extensions as { code?: string }).code ?? "")
        ) {
          return null;
        }
      }
      return event;
    },
  });
}

Steps to Reproduce

  1. Build an app with Sentry SDK using vercel/pkg.
  2. Run app and experience crash

Expected Result

App should run correctly

Actual Result

New ANR detection imports inspector module, which is unavailable when using vercel/pkg. This causes a following error:

 Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
    at new NodeError (node:internal/errors:388:5)
    at node:inspector:23:9
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:329:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:269:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
    at Module._load (node:internal/modules/cjs/loader:813:15)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/snapshot/app/node_modules/@sentry/node/cjs/anr/index.js:5:19) { 

I have reported the similar issue previously, so the solution should be similar: #6769

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDK

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions