Skip to content

Node Local Variables does not seem to work with ESM #7046

Description

@AbhiPrasad

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/node

SDK Version

7.32.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

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

Sentry.init({
  debug: true,
  beforeSend: (event) => {
    console.log(event.exception.values[0].stacktrace.frames[7]);
    return null;
  },
  dsn: "https://00000000000000000000000000000000@o000000.ingest.sentry.io/0000000",
  includeLocalVariables: true,
});

class Some {
  two(name) {
    throw new Error("Error with local variables");
  }
}

function one(name) {
  const arr = [1, "2", null];
  const obj = {
    name,
    num: 5,
  };

  const ty = new Some();

  ty.two(name);
}

one("some name");

Steps to Reproduce

https://discord.com/channels/621778831602221064/621786575591702529/1070801390223503502

Raised by @lbogdan (thanks!)

https://codesandbox.io/p/sandbox/node-sentry-local-variables-test-hg6zgb?file=%2Findex.js&selection=%5B%7B%22endColumn%22%3A18%2C%22endLineNumber%22%3A31%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A1%7D%5D

Expected Result

It works

Actual Result

ESM seems to be working with the inspector module differently.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions