getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.9k stars 1.56k forks source link

Regression: Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available when using vercel/pkg #12223

Closed munelear closed 2 months ago

munelear commented 4 months ago

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

8.4.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. Build app with Sentry SDK 8.4.0 using pkg
  2. Run app and experience crash

I verified that using sentry 7.31.0 does not have this issue, as noted in issue https://github.com/getsentry/sentry-javascript/issues/6769, this was previously fixed and at some point regressed.

Expected Result

App should not crash

Actual Result

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:792:20)
    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 86592 (/snapshot/dist/main.js) {
  code: 'ERR_INSPECTOR_NOT_AVAILABLE'
}
munelear commented 4 months ago

The regression appears to have happened in the 8.0.0 release timeframe. I am unable to reproduce this issue on 7.116.0.

mydea commented 4 months ago

Hey, thanks for writing in. What version of node are you using/running this in?

AbhiPrasad commented 4 months ago

Fix released with https://github.com/getsentry/sentry-javascript/releases/tag/8.5.0

munelear commented 4 months ago

FYI- I tried pulling in release 8.5.0 but I was still experiencing this issue. I'll re-review the release documentation and check if there's something wrong on my end, but I wanted to give you a heads up that this may not be completely resolved yet.

timfish commented 4 months ago

I can't reproduce any build or runtime errors with any v8 SDK version:

package.json

{
  "scripts": {
    "build": "pkg -t node18 index.js"
  },
  "dependencies": {
    "@sentry/node": "^8.5.0",
    "pkg": "^5.8.1"
  }
}

index.js

const Sentry = require('@sentry/node');

Sentry.init({
    dsn: '__DSN__',
    debug: true
});

setInterval(() => {
    console.log('Ping');
}, 1000);

Running:

> yarn && yarn build
> ./index
Sentry Logger [log]: Initializing Sentry: process: 92870, thread: main.
Sentry Logger [log]: Integration installed: InboundFilters
Sentry Logger [log]: Integration installed: FunctionToString
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: NodeFetch
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariables
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Running in CommonJS mode.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for diag v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for trace v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for context v1.8.0.
Sentry Logger [debug]: @opentelemetry/api: Registered a global for propagation v1.8.0.
Sentry Logger [log]: Could not load NodeFetch instrumentation.
Ping
Ping
Ping
Ping
Ping
Ping
Ping
Ping
getsantry[bot] commented 3 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀