sentry-javascript: Node Local Variables does not seem to work with ESM

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=[{"endColumn"%3A18%2C"endLineNumber"%3A31%2C"startColumn"%3A1%2C"startLineNumber"%3A1}]

Expected Result

It works

Actual Result

ESM seems to be working with the inspector module differently.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

What could maybe help as a first step is to add some tests for esm!