You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I debugged this with claude code and got the following:
I’ve identified the root cause: Sentry’s instrumentation is wrapping the sql method inherited from the Agent base class, but the wrapping is breaking the method’s return value. The sql method should return an array, but after wrapping, it’s returning something non-iterable (likely a Promise).
⸻
The Problem
The Agent class has a sql method that uses template literals and returns an array
Sentry wraps all methods on the Durable Object instance, including inherited ones
The wrapper uses Reflect.apply inside an async scope, which may cause the return value to become a Promise
When alarm() tries to iterate over the result with for (const row of result || []), it fails because Promises aren’t iterable
Sentry's DurableObject integration will silently break everyone's code unless it so happens every single one of their DurableObject's methods is async. Most of our are not. I can't believe this shipped.
Activity
linear commentedon Jul 19, 2025
JS-754 Cloudflare Durable Object instrumentDurableObjectWithSentry throwing errors
danieljvdm commentedon Jul 21, 2025
I debugged this with claude code and got the following:
I'm not sure what the best fix is, we could add
method === 'sql'to https://github.com/getsentry/sentry-javascript/blob/master/packages/cloudflare/src/durableobject.ts#L213 orwrapMethodWithSentrywould need to be updated to support the synchronous callback.Agents sql method: https://github.com/cloudflare/agents/blob/main/packages/agents/src/index.ts#L364
AbhiPrasad commentedon Jul 21, 2025
We should update
wrapMethodWithSentrynot async everything. @danieljvdm would you be interested in opening a PR?aroman commentedon Jul 27, 2025
Sentry's DurableObject integration will silently break everyone's code unless it so happens every single one of their DurableObject's methods is
async. Most of our are not. I can't believe this shipped.fix(cloudflare): Avoid turning DurableObject sync methods into async (#…
andreiborza commentedon Jul 28, 2025
A fix for this has been released with 9.42.1, thanks for reporting this and apologies for the inconvenience.
If this is still an issue, please feel free to raise it again or comment here.
github-actions commentedon Jul 31, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #17184, which was included in the 10.0.0 release.