Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/node-experimental/src/integrations/anr/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineIntegration, getCurrentScope } from '@sentry/core';
import type { Contexts, Event, EventHint, IntegrationFn } from '@sentry/types';
import { logger } from '@sentry/utils';
import * as inspector from 'inspector';
import { Worker } from 'worker_threads';
import { NODE_MAJOR, NODE_VERSION } from '../../nodeVersion';
import type { NodeClient } from '../../sdk/client';
Expand Down Expand Up @@ -29,11 +30,6 @@ async function getContexts(client: NodeClient): Promise<Contexts> {
return event?.contexts || {};
}

interface InspectorApi {
open: (port: number) => void;
url: () => string | undefined;
}

const INTEGRATION_NAME = 'Anr';

const _anrIntegration = ((options: Partial<AnrIntegrationOptions> = {}) => {
Expand Down Expand Up @@ -90,8 +86,6 @@ async function _startWorker(client: NodeClient, _options: Partial<AnrIntegration
};

if (options.captureStackTrace) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const inspector: InspectorApi = require('inspector');
if (!inspector.url()) {
inspector.open(0);
}
Expand Down
3 changes: 1 addition & 2 deletions packages/node-experimental/src/integrations/anr/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { createGetModuleFromFilename } from '../../utils/module';
import type { WorkerStartData } from './common';

type VoidFunction = () => void;
type InspectorSessionNodeV12 = InspectorSession & { connectToMainThread: VoidFunction };

const options: WorkerStartData = workerData;
let session: Session | undefined;
Expand Down Expand Up @@ -139,7 +138,7 @@ let debuggerPause: VoidFunction | undefined;
if (options.captureStackTrace) {
log('Connecting to debugger');

const session = new InspectorSession() as InspectorSessionNodeV12;
const session = new InspectorSession();
session.connectToMainThread();

log('Connected to debugger');
Expand Down
Loading