1111 * Learn more at https://developers.cloudflare.com/workers/
1212 */
1313import * as Sentry from '@sentry/cloudflare' ;
14- import { DurableObject } from " cloudflare:workers" ;
14+ import { DurableObject } from ' cloudflare:workers' ;
1515
1616class MyDurableObjectBase extends DurableObject < Env > {
1717 private throwOnExit = new WeakMap < WebSocket , Error > ( ) ;
@@ -44,7 +44,7 @@ class MyDurableObjectBase extends DurableObject<Env> {
4444 }
4545
4646 webSocketClose ( ws : WebSocket ) : void | Promise < void > {
47- if ( this . throwOnExit . has ( ws ) ) {
47+ if ( this . throwOnExit . has ( ws ) ) {
4848 const error = this . throwOnExit . get ( ws ) ! ;
4949 this . throwOnExit . delete ( ws ) ;
5050 throw error ;
@@ -53,36 +53,37 @@ class MyDurableObjectBase extends DurableObject<Env> {
5353}
5454
5555export const MyDurableObject = Sentry . instrumentDurableObjectWithSentry (
56- ( env : Env ) => ( {
57- dsn : env . E2E_TEST_DSN ,
58- environment : 'qa' , // dynamic sampling bias to keep transactions
59- tunnel : `http://localhost:3031/` , // proxy server
60- tracesSampleRate : 1.0 ,
61- sendDefaultPii : true ,
62- transportOptions : {
63- // We are doing a lot of events at once in this test
64- bufferSize : 1000 ,
65- } ,
66- } ) ,
67- MyDurableObjectBase ,
56+ ( env : Env ) => ( {
57+ dsn : env . E2E_TEST_DSN ,
58+ environment : 'qa' , // dynamic sampling bias to keep transactions
59+ tunnel : `http://localhost:3031/` , // proxy server
60+ tracesSampleRate : 1.0 ,
61+ sendDefaultPii : true ,
62+ transportOptions : {
63+ // We are doing a lot of events at once in this test
64+ bufferSize : 1000 ,
65+ } ,
66+ instrumentPrototypeMethods : true ,
67+ } ) ,
68+ MyDurableObjectBase ,
6869) ;
6970
7071export default Sentry . withSentry (
71- ( env : Env ) => ( {
72- dsn : env . E2E_TEST_DSN ,
73- environment : 'qa' , // dynamic sampling bias to keep transactions
74- tunnel : `http://localhost:3031/` , // proxy server
75- tracesSampleRate : 1.0 ,
76- sendDefaultPii : true ,
77- transportOptions : {
78- // We are doing a lot of events at once in this test
79- bufferSize : 1000 ,
80- } ,
81- } ) ,
82- {
83- async fetch ( request , env ) {
84- const url = new URL ( request . url ) ;
85- switch ( url . pathname ) {
72+ ( env : Env ) => ( {
73+ dsn : env . E2E_TEST_DSN ,
74+ environment : 'qa' , // dynamic sampling bias to keep transactions
75+ tunnel : `http://localhost:3031/` , // proxy server
76+ tracesSampleRate : 1.0 ,
77+ sendDefaultPii : true ,
78+ transportOptions : {
79+ // We are doing a lot of events at once in this test
80+ bufferSize : 1000 ,
81+ } ,
82+ } ) ,
83+ {
84+ async fetch ( request , env ) {
85+ const url = new URL ( request . url ) ;
86+ switch ( url . pathname ) {
8687 case '/rpc/throwException' :
8788 {
8889 const id = env . MY_DURABLE_OBJECT . idFromName ( 'foo' ) ;
@@ -105,7 +106,7 @@ export default Sentry.withSentry(
105106 return stub . fetch ( new Request ( url , request ) ) ;
106107 }
107108 }
108- return new Response ( 'Hello World!' ) ;
109- } ,
110- } satisfies ExportedHandler < Env > ,
109+ return new Response ( 'Hello World!' ) ;
110+ } ,
111+ } satisfies ExportedHandler < Env > ,
111112) ;
0 commit comments