Skip to content

@sentry/cloudflare not reporting errors thrown from Durable Objects #16786

Open
@jczstudios

Description

@jczstudios

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare

SDK Version

9.34.0

Framework Version

9.34.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

import { DurableObject } from "cloudflare:workers";
import * as Sentry from "@sentry/cloudflare";

class MyDurableObjectBase extends DurableObject<Env> {
	constructor(ctx: DurableObjectState, env: Env) {
		super(ctx, env);
	}

	async sayHello(name: string): Promise<string> {
		throw new Error("Should be recorded in Sentry.")
	}
}

export const MyDurableObject = Sentry.instrumentDurableObjectWithSentry(
	(env: Env) => ({
	  dsn: "__YOUR_DSN__",
	  tracesSampleRate: 1.0,
	  debug: true
	}),
	MyDurableObjectBase,
);

export default {
	async fetch(request, env, ctx): Promise<Response> {
		const id: DurableObjectId = env.MY_DURABLE_OBJECT.idFromName("foo");

		const stub = env.MY_DURABLE_OBJECT.get(id);

		const greeting = await stub.sayHello("world");

		return new Response(greeting);
	},
} satisfies ExportedHandler<Env>;

Steps to Reproduce

  1. Send fetch request to a worker instrumented with Sentry.instrumentDurableObjectWithSentry where the Durable Object RPC method throws when called by the worker. (see example above)
  2. No Sentry logs (console) / errors are recorded.

Expected Result

Sentry should record errors thrown according to the docs

Additionally, since debug: true is set, there should be debug logs from the Sentry library.

Actual Result

Image

No debug logs visible, no errors reported to Sentry.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions