11
11
* Learn more at https://developers.cloudflare.com/workers/
12
12
*/
13
13
import * as Sentry from '@sentry/cloudflare' ;
14
- import { DurableObject } from " cloudflare:workers" ;
14
+ import { DurableObject } from ' cloudflare:workers' ;
15
15
16
16
class MyDurableObjectBase extends DurableObject < Env > {
17
17
private throwOnExit = new WeakMap < WebSocket , Error > ( ) ;
@@ -44,7 +44,7 @@ class MyDurableObjectBase extends DurableObject<Env> {
44
44
}
45
45
46
46
webSocketClose ( ws : WebSocket ) : void | Promise < void > {
47
- if ( this . throwOnExit . has ( ws ) ) {
47
+ if ( this . throwOnExit . has ( ws ) ) {
48
48
const error = this . throwOnExit . get ( ws ) ! ;
49
49
this . throwOnExit . delete ( ws ) ;
50
50
throw error ;
@@ -53,36 +53,37 @@ class MyDurableObjectBase extends DurableObject<Env> {
53
53
}
54
54
55
55
export 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 ,
68
69
) ;
69
70
70
71
export 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 ) {
86
87
case '/rpc/throwException' :
87
88
{
88
89
const id = env . MY_DURABLE_OBJECT . idFromName ( 'foo' ) ;
@@ -105,7 +106,7 @@ export default Sentry.withSentry(
105
106
return stub . fetch ( new Request ( url , request ) ) ;
106
107
}
107
108
}
108
- return new Response ( 'Hello World!' ) ;
109
- } ,
110
- } satisfies ExportedHandler < Env > ,
109
+ return new Response ( 'Hello World!' ) ;
110
+ } ,
111
+ } satisfies ExportedHandler < Env > ,
111
112
) ;
0 commit comments