René's URL Explorer Experiment


Title: instrumentDurableObjectStorage Proxy breaks native `storage.sql` getter (Illegal invocation) · Issue #19661 · getsentry/sentry-javascript · GitHub

Open Graph Title: instrumentDurableObjectStorage Proxy breaks native `storage.sql` getter (Illegal invocation) · Issue #19661 · getsentry/sentry-javascript

X Title: instrumentDurableObjectStorage Proxy breaks native `storage.sql` getter (Illegal invocation) · Issue #19661 · getsentry/sentry-javascript

Description: Problem Since 10.39.0, instrumentDurableObjectWithSentry breaks any DurableObject that accesses ctx.storage.sql (SQLite storage API). Both production workerd and miniflare are affected. Error: SqlError: SQL query failed: Illegal invocati...

Open Graph Description: Problem Since 10.39.0, instrumentDurableObjectWithSentry breaks any DurableObject that accesses ctx.storage.sql (SQLite storage API). Both production workerd and miniflare are affected. Error: SqlE...

X Description: Problem Since 10.39.0, instrumentDurableObjectWithSentry breaks any DurableObject that accesses ctx.storage.sql (SQLite storage API). Both production workerd and miniflare are affected. Error: SqlE...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"instrumentDurableObjectStorage Proxy breaks native `storage.sql` getter (Illegal invocation)","articleBody":"## Problem\n\nSince 10.39.0, `instrumentDurableObjectWithSentry` breaks any DurableObject that accesses `ctx.storage.sql` (SQLite storage API). Both production workerd and miniflare are affected.\n\n**Error:**\n```\nSqlError: SQL query failed: Illegal invocation: function called with incorrect `this` reference.\n```\n\n10.38.0 works. 10.39.0+ does not.\n\n## Root Cause\n\n`instrumentDurableObjectStorage` (in `packages/cloudflare/src/instrumentations/instrumentDurableObjectStorage.ts`) wraps `DurableObjectStorage` in a Proxy whose `get` trap uses `Reflect.get(target, prop, receiver)` where `receiver` is the proxy:\n\n```ts\nget(target, prop, receiver) {\n  const original = Reflect.get(target, prop, receiver); // receiver = proxy\n```\n\nWhen accessing `storage.sql`, the native getter on `DurableObjectStorage` validates `this` via internal slots (brand check). Passing the proxy as `receiver` means the getter executes with `this` = proxy instead of the real native storage object, failing the brand check.\n\nNon-function properties like `sql` (a getter returning `SqlStorage`) hit the `typeof original !== 'function'` early return and are returned directly — but by then the getter has already been called with the wrong `this`.\n\n**Why KV methods (`get`/`put`/`delete`/`list`) are unaffected:** they are functions, so the proxy explicitly `.bind(target)`s them or wraps them with `Reflect.apply(original, target, args)`. The `this` is correct for functions, but not for getters.\n\n## Fix\n\nOne-line change — use `target` as the receiver:\n\n```diff\n- get(target, prop, receiver) {\n-   const original = Reflect.get(target, prop, receiver);\n+ get(target, prop, _receiver) {\n+   const original = Reflect.get(target, prop, target);\n```\n\nThis ensures native getters execute with the real storage object as `this`.\n\n## Minimal Reproduction\n\n```ts\nimport { DurableObject } from \"cloudflare:workers\";\nimport { instrumentDurableObjectWithSentry } from \"@sentry/cloudflare\";\n\nclass CounterBase extends DurableObject {\n  constructor(ctx: DurableObjectState, env: Env) {\n    super(ctx, env);\n    // Throws: SqlError: Illegal invocation\n    this.ctx.storage.sql.exec(\n      \"CREATE TABLE IF NOT EXISTS counts (name TEXT PRIMARY KEY, value INTEGER DEFAULT 0)\"\n    );\n  }\n}\n\nexport const Counter = instrumentDurableObjectWithSentry(\n  (env) => ({ dsn: env.SENTRY_DSN }),\n  CounterBase,\n);\n```\n\n## Related\n\n- #17094 — similar `instrumentContext` issue, but about sync methods being wrapped async. Fixed in v9.42.1/v10.0.0 via #17184. The `Reflect.get` receiver issue is a different root cause not addressed by that fix.\n\n## Environment\n\n- `@sentry/cloudflare` 10.39.0+ (any version with `instrumentDurableObjectStorage`)\n- Both production workerd and miniflare\n- Any DurableObject using SQLite storage API (`ctx.storage.sql`)","author":{"url":"https://github.com/dmmulroy","@type":"Person","name":"dmmulroy"},"datePublished":"2026-03-05T21:00:56Z","url":"https://github.com/getsentry/sentry-javascript/issues/19661"}

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:9771821e-1305-2fa0-be59-2e6a99e82d37
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD3E2:2CBDB8:246404:308298:6B04E8AF
html-safe-nonce079cce7b54f6f443f4617cc325fd7280deba8ddbb58a871d3025acd00b93c3a8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0UyOjJDQkRCODoyNDY0MDQ6MzA4Mjk4OjZCMDRFOEFGIiwidmlzaXRvcl9pZCI6IjIzOTk3MzA1Nzk0ODc5MTAwNjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac3856591c78cd83d68d674d2c2dfcb54dd362665a005524d5bec53cd43ff79e5a
hovercard-subject-tagissue:4030591619
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/19661/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c41e076d1f8bcf57b06b03a0f15e6ceaaa8b9a7e8509e16337a6e11d7fa27805/getsentry/sentry-javascript/issues/19661
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c41e076d1f8bcf57b06b03a0f15e6ceaaa8b9a7e8509e16337a6e11d7fa27805/getsentry/sentry-javascript/issues/19661
og:image:altProblem Since 10.39.0, instrumentDurableObjectWithSentry breaks any DurableObject that accesses ctx.storage.sql (SQLite storage API). Both production workerd and miniflare are affected. Error: SqlE...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedmmulroy
hostnamegithub.com
expected-hostnamegithub.com
Nonef3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32
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
releasee29c922455fd8137f27e1cfcdf6a1e8b920b1926
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript/issues/19661#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript%2Fissues%2F19661
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%2F19661
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/19661
Reloadhttps://github.com/getsentry/sentry-javascript/issues/19661
Reloadhttps://github.com/getsentry/sentry-javascript/issues/19661
getsentryhttps://github.com/getsentry
sentry-javascripthttps://github.com/getsentry/sentry-javascript
Codehttps://github.com/getsentry/sentry-javascript
Issues334 (334)https://github.com/getsentry/sentry-javascript/issues
Pull requests51 (51)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/19661
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/19661
#19662https://github.com/getsentry/sentry-javascript/pull/19662
instrumentDurableObjectStorage Proxy breaks native storage.sql getter (Illegal invocation)https://github.com/getsentry/sentry-javascript/issues/19661#top
#19662https://github.com/getsentry/sentry-javascript/pull/19662
https://github.com/nicohrubec
https://github.com/dmmulroy
dmmulroyhttps://github.com/dmmulroy
on Mar 5, 2026https://github.com/getsentry/sentry-javascript/issues/19661#issue-4030591619
Cloudflare Durable Object instrumentDurableObjectWithSentry throwing errors #17094https://github.com/getsentry/sentry-javascript/issues/17094
fix(cloudflare): Avoid turning DurableObject sync methods into async #17184https://github.com/getsentry/sentry-javascript/pull/17184
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 Mar 5, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23311658662
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Mar 5, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23311659922
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Mar 5, 2026https://github.com/getsentry/sentry-javascript/issues/19661
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Mar 5, 2026https://github.com/getsentry/sentry-javascript/issues/19661#issuecomment-4007932650
Linear Codehttps://linear.app
JS-1868https://linear.app/getsentry/issue/JS-1868/instrumentdurableobjectstorage-proxy-breaks-native-storagesql-getter
nicohrubechttps://github.com/nicohrubec
on Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23325392339
https://github.com/nicohrubec
nicohrubechttps://github.com/nicohrubec
on Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661#issuecomment-4010703994
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 Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23327434580
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661
nicohrubechttps://github.com/nicohrubec
on Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23328258226
fix(cloudflare): use correct Proxy receiver in instrumentDurableObjec…https://github.com/getsentry/sentry-javascript/commit/f820401ac14705220bb14218638449133c261930
https://docs.github.com/articles/closing-issues-via-commit-messages
f820401https://github.com/getsentry/sentry-javascript/commit/f820401ac14705220bb14218638449133c261930
nicohrubechttps://github.com/nicohrubec
completedhttps://github.com/getsentry/sentry-javascript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#19662https://github.com/getsentry/sentry-javascript/pull/19662
on Mar 6, 2026https://github.com/getsentry/sentry-javascript/issues/19661#event-23328258230
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Mar 10, 2026https://github.com/getsentry/sentry-javascript/issues/19661#issuecomment-4029964834
GitHub Actionshttps://help.github.com/en/actions
#19662https://github.com/getsentry/sentry-javascript/pull/19662
10.43.0 releasehttps://github.com/getsentry/sentry-javascript/releases/tag/10.43.0
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript/issues/19661
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript/issues/19661
nicohrubechttps://github.com/nicohrubec
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.