GeezerVison is showing github.com — fix(core): Avoid stack overflow in FunctionToString on cyclic Proxy prototype chains by chargome · Pull Request #26162 · getsentry/sentry-javascript
Conversation
chargome
commented
Nov 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Why: The patched toString looked up __sentry_original__ through the prototype chain. If that chain loops through a Proxy, the lookup overflows the stack, while native toString works fine. We now only read it when it's an own property, which is where markFunctionWrapped puts it.
The Hono proxies only exposed it through a get trap, so they now report it as an own property too.
Closes #25963
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…rototype chains
The patched toString read __sentry_original__ through the prototype chain. When that chain
loops back through a Proxy, the lookup never ends and overflows the stack, while native
toString returns normally. Only unwrap when the original is an own property, which is how
markFunctionWrapped stores it, and fall back to native toString if the lookup throws.
The Hono proxies exposed __sentry_original__ only through a get trap, so they also report it
as an own property now to keep unwrapping.
Fixes #25963
Co-Authored-By: Claude Opus 5.5 <[email protected]>
cursor[bot] reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3079ba0. Configure here.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
size-limit report 📦
Compared: 840f27e (PR test merge using develop at 4c9a4eb)
Against: 4c9a4eb (develop) · base run #65205
✅ Baseline matches: this diff contains only this PR's changes.
| Path |
Size |
% Change |
Change |
| @sentry/browser |
30.41 kB |
+0.04% |
+12 B 🔺 |
| @sentry/browser - with treeshaking flags |
28.55 kB |
+0.04% |
+10 B 🔺 |
| @sentry/browser - with treeshaking flags tracing without tracing |
28.44 kB |
+0.04% |
+11 B 🔺 |
| @sentry/browser (incl. Tracing) |
52.73 kB |
+0.02% |
+8 B 🔺 |
| @sentry/browser (incl. Tracing + Span Streaming) |
52.74 kB |
+0.02% |
+9 B 🔺 |
| @sentry/browser (incl. Tracing, Profiling) |
55.71 kB |
+0.02% |
+7 B 🔺 |
| @sentry/browser (incl. Tracing, Replay) |
93.05 kB |
+0.02% |
+13 B 🔺 |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags |
81.64 kB |
+0.02% |
+11 B 🔺 |
| @sentry/browser (incl. Tracing, Replay with Canvas) |
97.79 kB |
+0.02% |
+14 B 🔺 |
| @sentry/browser (incl. Tracing, Replay, Feedback) |
110.78 kB |
+0.01% |
+10 B 🔺 |
| @sentry/browser (incl. Feedback) |
48 kB |
+0.04% |
+16 B 🔺 |
| @sentry/browser (incl. sendFeedback) |
35.52 kB |
+0.04% |
+12 B 🔺 |
| @sentry/browser (incl. FeedbackAsync) |
40.62 kB |
+0.05% |
+17 B 🔺 |
| @sentry/browser (incl. Metrics) |
31.45 kB |
+0.05% |
+13 B 🔺 |
| @sentry/browser (incl. Logs) |
31.74 kB |
+0.05% |
+15 B 🔺 |
| @sentry/browser (incl. Metrics & Logs) |
32.46 kB |
+0.05% |
+13 B 🔺 |
| @sentry/react |
32.29 kB |
+0.02% |
+5 B 🔺 |
| @sentry/react (incl. Tracing) |
55.12 kB |
+0.04% |
+21 B 🔺 |
| @sentry/vue |
38.68 kB |
+0.03% |
+11 B 🔺 |
| @sentry/vue (incl. Tracing) |
55.75 kB |
+0.02% |
+6 B 🔺 |
| @sentry/svelte |
30.44 kB |
+0.04% |
+12 B 🔺 |
| @sentry/remix (Remix 3 client bundle) |
57.84 kB |
+0.05% |
+24 B 🔺 |
| CDN Bundle |
32.21 kB |
+0.05% |
+13 B 🔺 |
| CDN Bundle (incl. Tracing) |
53.28 kB |
+0.05% |
+24 B 🔺 |
| CDN Bundle (incl. Logs, Metrics) |
34.48 kB |
+0.05% |
+15 B 🔺 |
| CDN Bundle (incl. Tracing, Logs, Metrics) |
55.22 kB |
+0.04% |
+19 B 🔺 |
| CDN Bundle (incl. Replay, Logs, Metrics) |
75.89 kB |
+0.03% |
+16 B 🔺 |
| CDN Bundle (incl. Tracing, Replay) |
91.5 kB |
+0.03% |
+22 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) |
93.43 kB |
+0.03% |
+23 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Feedback) |
97.6 kB |
+0.03% |
+24 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) |
99.59 kB |
+0.02% |
+19 B 🔺 |
| CDN Bundle - uncompressed |
94.74 kB |
+0.08% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing) - uncompressed |
157.74 kB |
+0.05% |
+73 B 🔺 |
| CDN Bundle (incl. Logs, Metrics) - uncompressed |
101.22 kB |
+0.08% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed |
163.48 kB |
+0.05% |
+73 B 🔺 |
| CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed |
232.78 kB |
+0.04% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing, Replay) - uncompressed |
279.44 kB |
+0.03% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed |
285.16 kB |
+0.03% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed |
293.14 kB |
+0.03% |
+73 B 🔺 |
| CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed |
298.85 kB |
+0.03% |
+73 B 🔺 |
| @sentry/nextjs (client) |
58.07 kB |
+0.03% |
+17 B 🔺 |
| @sentry/sveltekit (client) |
53.25 kB |
+0.02% |
+9 B 🔺 |
| @sentry/core/server |
44.25 kB |
- |
- |
| @sentry/core/browser |
13.93 kB |
- |
- |
| @sentry/node |
157.04 kB |
+0.06% |
+88 B 🔺 |
| @sentry/node/import (ESM hook with diagnostics-channel injection) |
82.28 kB |
- |
- |
| @sentry/node - without tracing |
97.12 kB |
+0.1% |
+94 B 🔺 |
| @sentry/node - without channel injection |
137.38 kB |
+0.07% |
+89 B 🔺 |
| @sentry/aws-serverless |
105.48 kB |
+0.1% |
+97 B 🔺 |
| @sentry/cloudflare (withSentry) - minified |
200.76 kB |
+0.04% |
+79 B 🔺 |
| @sentry/cloudflare (withSentry) |
499.11 kB |
+0.02% |
+55 B 🔺 |
| @sentry/nextjs/cloudflare (withSentry) - minified |
222.76 kB |
+0.04% |
+79 B 🔺 |
View base workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Optional E2E tests
Some optional checks were not successful. They do not block the merge. 6 not successful, 50 successful. See the run.
|
Check |
Status |
|
| ❌ |
CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) |
Failing after 10m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) |
Failing after 54s |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) |
Failing after 2m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) |
Failing after 1m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-eve Test (optional) |
Failing after 2m |
Details |
| ❌ |
CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) |
Failing after 9m |
Details |
Successful checks
|
Check |
Status |
|
| ✅ |
CI: Optional E2E Tests / E2E astro-7 Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) |
Successful in 45s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) |
Successful in 10m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) |
Successful in 53s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) |
Successful in 45s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) |
Successful in 49s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E astro-7-static Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) |
Successful in 45s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-mastra Test (optional) |
Successful in 9m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) |
Successful in 42s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) |
Successful in 55s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) |
Successful in 12m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) |
Successful in 43s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) |
Successful in 4m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) |
Successful in 12m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) |
Successful in 13m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) |
Successful in 42s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) |
Successful in 54s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) |
Successful in 55s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E deno (latest) Test (optional) |
Successful in 12m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) |
Successful in 40s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) |
Successful in 10m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) |
Successful in 3m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) |
Successful in 52s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) |
Successful in 44s |
Details |
| ✅ |
CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) |
Successful in 2m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-flue Test (optional) |
Successful in 11m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-pi-durable Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E solidstart-2 Test (optional) |
Successful in 1m |
Details |
| ✅ |
CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) |
Successful in 57s |
Details |
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just inline this and avoid the extra function and the eslint disabling
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
unwrappedFunction = originalFunction;
|
|
|
// `markFunctionWrapped` sets the original as an own property. An inherited lookup could walk a
|
|
|
// prototype chain that loops through a Proxy and overflow the stack, which native `toString` never does.
|
|
|
if (SETUP_CLIENTS.has(getClient() as Client) && hasOwnProperty(this, '__sentry_original__')) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
if (SETUP_CLIENTS.has(getClient() as Client) && hasOwnProperty(this, '__sentry_original__')) { |
|
if (SETUP_CLIENTS.has(getClient() as Client) && Object.prototype.hasOwnProperty.call(this, '__sentry_original__')) { |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This brings back the exact issue we gave as the reason for closing #25964
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
andreiborza reacted with thumbs up emoji
Comment on lines
+22
to
+26
|
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
|
const hasOwnProperty = Function.prototype.call.bind(Object.prototype.hasOwnProperty) as (
|
|
|
obj: unknown,
|
|
|
key: PropertyKey,
|
|
|
) => boolean;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
// eslint-disable-next-line @typescript-eslint/unbound-method |
|
const hasOwnProperty = Function.prototype.call.bind(Object.prototype.hasOwnProperty) as ( |
|
obj: unknown, |
|
key: PropertyKey, |
|
) => boolean; |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
43081j
pushed a commit
to 43081j/sentry-javascript
that referenced
this pull request
Nov 9, 2026
…rototype chains (getsentry#26162)
**Why:** The patched `toString` looked up `__sentry_original__` through
the prototype chain. If that chain loops through a Proxy, the lookup
overflows the stack, while native `toString` works fine. We now only
read it when it's an own property, which is where `markFunctionWrapped`
puts it.
The Hono proxies only exposed it through a `get` trap, so they now
report it as an own property too.
Closes getsentry#25963
Co-authored-by: Claude Opus 5.5 <[email protected]>
Reviewers
nicohrubec
Awaiting requested review from nicohrubec
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|