Skip to content

Commit 7bde558

Browse files
authored
feat(js): Update esm warning for local variables (#11691)
1 parent 338ee71 commit 7bde558

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

docs/platforms/javascript/common/configuration/integrations/localvariables.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ Sentry.init({
4444

4545
The local variables integration only captures local variables from application code (`in_app = true`). Frames of a stacktrace originating from `node_modules` will not have local variables attached to them.
4646

47+
<Alert level="warning" title="Issues with ESM">
48+
49+
Due to an [open Node.js issue](https://github.com/nodejs/node/issues/38439), we are currently unable to capture local variables for unhandled errors when using JavaScript modules (ESM).
50+
51+
To work around this, wrap relevant code in a try-catch block and call `captureException` with the error so that Sentry can capture local variables.
52+
53+
```javascript
54+
try {
55+
// Your code here
56+
} catch (error) {
57+
Sentry.captureException(error);
58+
}
59+
```
60+
61+
</Alert>
62+
4763
<Alert level="warning" title="Minified Variables">
4864

4965
Minified local variable names attached to exception frames can't be unminified by Sentry at this time. There's an [active proposal](https://github.com/tc39/source-map/blob/main/proposals/scopes.md) for the sourcemaps spec that will add this capability.

docs/platforms/javascript/common/configuration/options.mdx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,9 @@ Set this boolean to `false` to disable sending of client reports. Client reports
245245
<PlatformCategorySection supported={['server', 'serverless']}>
246246
<ConfigKey name="include-local-variables">
247247

248-
Set this boolean to `true` to add stack local variables to stack traces.
248+
Set this boolean to `true` to add stack local variables to stack traces. Defaults to `false`.
249249

250-
<Alert level="warning">
251-
252-
Due to an [open Node.js issue](https://github.com/nodejs/node/issues/38439), we are currently unable to capture local variables for unhandled errors when using
253-
JavaScript modules (ESM).
254-
255-
See the <PlatformLink to="/configuration/integrations/localvariables">integration options</PlatformLink> for a workaround.
256-
257-
</Alert>
250+
For more advanced configuration options, see the documentation on the <PlatformLink to="/configuration/integrations/localvariables">Local Variables integration options</PlatformLink>.
258251

259252
</ConfigKey>
260253
</PlatformCategorySection>

0 commit comments

Comments
 (0)