René's URL Explorer Experiment


Title: instrumentAgentWithSentry: @callable() methods are lost after a constructor throws once · Issue #25728 · getsentry/sentry-javascript · GitHub

Open Graph Title: instrumentAgentWithSentry: @callable() methods are lost after a constructor throws once · Issue #25728 · getsentry/sentry-javascript

X Title: instrumentAgentWithSentry: @callable() methods are lost after a constructor throws once · Issue #25728 · getsentry/sentry-javascript

Description: Package: @sentry/cloudflare 11.4.0, with agents 0.30.1, Workers compatibility date 2026-10-01 What happens If an Agent's constructor throws once (in our case the Durable Objects free tier's rows-read limit during storage initialization),...

Open Graph Description: Package: @sentry/cloudflare 11.4.0, with agents 0.30.1, Workers compatibility date 2026-10-01 What happens If an Agent's constructor throws once (in our case the Durable Objects free tier's rows-re...

X Description: Package: @sentry/cloudflare 11.4.0, with agents 0.30.1, Workers compatibility date 2026-10-01 What happens If an Agent's constructor throws once (in our case the Durable Objects free tier's...

Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25728

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"instrumentAgentWithSentry: @callable() methods are lost after a constructor throws once","articleBody":"**Package:** `@sentry/cloudflare` 11.4.0, with `agents` 0.30.1, Workers compatibility date 2026-10-01\n\n## What happens\n\nIf an Agent's constructor throws once (in our case the Durable Objects free tier's rows-read limit during storage initialization), the next construction of the same class loses its `@callable()` methods. RPC calls from a connected client then fail with `Method callTool is not callable`.\n\n## Why\n\nIn `constructInstrumentedDurableObject` (`build/*/durableobject.js`), `methodsBeforeConstruction` is resolved from the prototype on every construction until `frameworkManagedMethodsCache` holds an entry for that prototype. That entry is only written after `Reflect.construct` returns. When the constructor throws, the Agents SDK has already replaced the prototype's methods with its wrapped versions, but no cache entry is written. On the next construction, Sentry snapshots the *wrapped* methods as the originals, so it no longer recognizes them as framework-managed, and the callable registration is lost.\n\n## Reproduction (vitest-pool-workers)\n\nThe test needs a Durable Object binding named `MyAgent` in the Worker's test config, bound to any Agent class; it only borrows that object's `state`, and the test's own `RecoveryAgent` does the rest.\n\n```ts\nimport { runInDurableObject } from \"cloudflare:test\";\nimport { env } from \"cloudflare:workers\";\nimport * as Sentry from \"@sentry/cloudflare\";\nimport { Agent, callable } from \"agents\";\nimport { expect, test } from \"vitest\";\n\ntest(\"callable methods survive construction retry after a constructor failure\", async () => {\n  await runInDurableObject(env.MyAgent.getByName(crypto.randomUUID()), async (_obj, state) => {\n    let fail = true;\n    class RecoveryAgent extends Agent\u003cEnv> {\n      constructor(ctx: DurableObjectState, bindings: Env) {\n        super(ctx, bindings);\n        if (fail) {\n          fail = false;\n          throw new Error(\"Exceeded allowed rows read in Durable Objects free tier.\");\n        }\n      }\n      @callable()\n      async read() {\n        return \"ready\";\n      }\n    }\n    const Wrapped = Sentry.instrumentAgentWithSentry(() => ({ dsn: \"\" }), RecoveryAgent);\n    expect(() => new Wrapped(state, env)).toThrow(\"Exceeded allowed rows read\");\n    const recovered = new Wrapped(state, env);\n    expect(recovered.getCallableMethods().has(\"read\")).toBe(true); // fails on 11.4.0\n  });\n});\n```\n\n## Workaround we are running\n\nCache the pre-construction snapshot per prototype, so a retry after a failure reuses the first snapshot:\n\n```diff\n-  const methodsBeforeConstruction = cachedFrameworkManagedMethods ? void 0 : resolvePrototypeMethods(prototype);\n+  let methodsBeforeConstruction = methodsBeforeConstructionCache.get(prototype);\n+  if (!cachedFrameworkManagedMethods && !methodsBeforeConstruction) {\n+    methodsBeforeConstruction = resolvePrototypeMethods(prototype);\n+    methodsBeforeConstructionCache.set(prototype, methodsBeforeConstruction);\n+  }\n ...\n const frameworkManagedMethodsCache = /* @__PURE__ */ new WeakMap();\n+const methodsBeforeConstructionCache = /* @__PURE__ */ new WeakMap();\n```\n\nHappy to open a PR with this and the test if the approach looks right.\n","author":{"url":"https://github.com/nuntz","@type":"Person","name":"nuntz"},"datePublished":"2026-10-24T15:02:36Z","url":"https://github.com/getsentry/sentry-javascript/issues/25728"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c47ffbd0-5b21-bf31-631f-d69c294bfd5f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8100:2A3275:752B8D:A4B397:6B044D8F
html-safe-nonce635baa7d64b087f90a6d037665a3b20c7ae2faa593c22dea2887fa9665ae4e5c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTAwOjJBMzI3NTo3NTJCOEQ6QTRCMzk3OjZCMDQ0RDhGIiwidmlzaXRvcl9pZCI6IjYyOTE3NjQwODQwOTQ1NTM0ODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac16ce8c86ca8e96b57f1b4e06f18ca986516a082a0031a691f28ec0a4f79234b9
hovercard-subject-tagissue:6014301420
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25728/issue_layout
twitter:imagehttps://opengraph.githubassets.com/82936c1cb3ffbf204193e82b0f7070b9c293a270c8cf5dc3a44fa767e266301f/getsentry/sentry-javascript/issues/25728
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/82936c1cb3ffbf204193e82b0f7070b9c293a270c8cf5dc3a44fa767e266301f/getsentry/sentry-javascript/issues/25728
og:image:altPackage: @sentry/cloudflare 11.4.0, with agents 0.30.1, Workers compatibility date 2026-10-01 What happens If an Agent's constructor throws once (in our case the Durable Objects free tier's rows-re...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamenuntz
hostnamegithub.com
expected-hostnamegithub.com
None002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3328572
octolytics-dimension-repository_nwogetsentry/sentry-javascript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3328572
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release059f24c781e3a0d7df3f27a97da0e93fab06ae39
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/25728#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F25728
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F25728
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript
Reloadhttps://github.com/getsentry/sentry-javascript/issues/25728
Reloadhttps://github.com/getsentry/sentry-javascript/issues/25728
Reloadhttps://github.com/getsentry/sentry-javascript/issues/25728
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues339 (339)https://github.com/getsentry/sentry-javascript/issues
Pull requests55 (55)https://github.com/getsentry/sentry-javascript/pulls
Discussionshttps://github.com/getsentry/sentry-javascript/discussions
Actionshttps://github.com/getsentry/sentry-javascript/actions
Security and quality7 (7)https://github.com/getsentry/sentry-javascript/security
Insightshttps://github.com/getsentry/sentry-javascript/insights
https://github.com/getsentry/sentry-javascript
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/25728
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/25728
#25851https://github.com/getsentry/sentry-javascript/pull/25851
instrumentAgentWithSentry: @callable() methods are lost after a constructor throws oncehttps://github.com/getsentry/sentry-javascript/issues/25728#top
#25851https://github.com/getsentry/sentry-javascript/pull/25851
Cloudflare Workershttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Cloudflare%20Workers%22
https://github.com/nuntz
nuntzhttps://github.com/nuntz
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728#issue-6014301420
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-34134230398
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728#issuecomment-6385751171
Linear Codehttps://linear.app
JS-3996https://linear.app/getsentry/issue/JS-3996
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-34134232133
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728
linear-codehttps://github.com/apps/linear-code
Cloudflare Workershttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Cloudflare%20Workers%22
on Oct 24, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-34134268973
https://github.com/logaretm
logaretmhttps://github.com/logaretm
on Oct 26, 2026https://github.com/getsentry/sentry-javascript/issues/25728#issuecomment-6423068499
Linear Codehttps://linear.app
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Oct 26, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-34287517836
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Oct 26, 2026https://github.com/getsentry/sentry-javascript/issues/25728
JPeer264https://github.com/JPeer264
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#25851https://github.com/getsentry/sentry-javascript/pull/25851
on Nov 10, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-35689542487
kunal649https://github.com/kunal649
on Nov 10, 2026https://github.com/getsentry/sentry-javascript/issues/25728#event-35695347148
fix(cloudflare): Keep framework-managed methods when a Durable Object…https://github.com/kunal649/sentry-javascript/commit/39b10d84fbbb3c19ef80734b15ff5fe1b00ee8ab
https://docs.github.com/articles/closing-issues-via-commit-messages
39b10d8https://github.com/kunal649/sentry-javascript/commit/39b10d84fbbb3c19ef80734b15ff5fe1b00ee8ab
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Nov 10, 2026https://github.com/getsentry/sentry-javascript/issues/25728#issuecomment-6772338353
GitHub Actionshttps://help.github.com/en/actions
#25851https://github.com/getsentry/sentry-javascript/pull/25851
11.12.0 releasehttps://github.com/getsentry/sentry-javascript/releases/tag/11.12.0
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/25728
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/25728
Cloudflare Workershttps://github.com/getsentry/sentry-javascript/issues?q=state%3Aopen%20label%3A%22Cloudflare%20Workers%22
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.