High-memory usage when includeLocalVariables is enabled.
Opened this issue · 6 comments
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
10.15.0
Framework Version
No response
Link to Sentry event
No response
Reproduction Example/SDK Setup
sentryClient ??= Sentry.init({
dsn: config.sentryDSN,
environment: config.environment,
includeLocalVariables: sentryOptions?.includeLocalVariables ?? true,
})Steps to Reproduce
- Deploy a NodeJS AWS lambda using Sentry with
includeLocalVariablesset to true - The following will show up in CloudWatch:
2025-09-23T08:09:07.650Z Debugger listening on ws://127.0.0.1:44271/d9491547-4ba5-4a4f-b78f-0c1b424fc39e
2025-09-23T08:09:07.650Z For help, see: https://nodejs.org/en/docs/inspector
Expected Result
includeLocalVariables should be able to capture the local variables without interfering with the application
Actual Result
The lambda will crash either immediately for after a few runs (memory leak?)
REPORT RequestId: 1c21914d-093b-5809-a3aa-f00152357227 Duration: 88045.34 ms Billed Duration: 88046 ms Memory Size: 3072 MB Max Memory Used: 3072 MB Status: error Error Type: Runtime.OutOfMemory
Note: The lambda is configured with 3GB RAM
Additional Context
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Hi @canassa, thanks for writing in.
Could you please provide some more context? Are you using our Lambda Layer, also you specified @sentry/node in the issue, are you using that or our @sentry/aws-serverless package tailored towards AWS?
Hi @andreiborza
Are you using our Lambda Layer
No
are you using that or our @sentry/aws-serverless package tailored towards AWS?
We are using @sentry/node directly and manually initialising Sentry with Sentry.init
Got it, thanks. Could you please provide a small reproduction repo of the lambda function?
I’ll see if I can put one together.
Just a quick update:
I created a minimal reproducible repo, but the memory leak does not appear there.
The issue is reproducible only in my main application, which I cannot share.
I’ll start stripping down parts of the main application to isolate the cause. Please keep this ticket open.