@@ -14,7 +14,6 @@ import { getFinalOptions } from './options';
14
14
import { wrapRequestHandler } from './request' ;
15
15
import { addCloudResourceContext } from './scope-utils' ;
16
16
import { init } from './sdk' ;
17
- import { copyExecutionContext } from './utils/copyExecutionContext' ;
18
17
19
18
/**
20
19
* Wrapper for Cloudflare handlers.
@@ -38,11 +37,9 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
38
37
if ( 'fetch' in handler && typeof handler . fetch === 'function' && ! isInstrumented ( handler . fetch ) ) {
39
38
handler . fetch = new Proxy ( handler . fetch , {
40
39
apply ( target , thisArg , args : Parameters < ExportedHandlerFetchHandler < Env , CfHostMetadata > > ) {
41
- const [ request , env , ctx ] = args ;
40
+ const [ request , env , context ] = args ;
42
41
43
42
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
44
- const context = copyExecutionContext ( ctx ) ;
45
- args [ 2 ] = context ;
46
43
47
44
return wrapRequestHandler ( { options, request, context } , ( ) => target . apply ( thisArg , args ) ) ;
48
45
} ,
@@ -74,9 +71,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
74
71
if ( 'scheduled' in handler && typeof handler . scheduled === 'function' && ! isInstrumented ( handler . scheduled ) ) {
75
72
handler . scheduled = new Proxy ( handler . scheduled , {
76
73
apply ( target , thisArg , args : Parameters < ExportedHandlerScheduledHandler < Env > > ) {
77
- const [ event , env , ctx ] = args ;
78
- const context = copyExecutionContext ( ctx ) ;
79
- args [ 2 ] = context ;
74
+ const [ event , env , context ] = args ;
80
75
return withIsolationScope ( isolationScope => {
81
76
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
82
77
const waitUntil = context . waitUntil . bind ( context ) ;
@@ -119,9 +114,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
119
114
if ( 'email' in handler && typeof handler . email === 'function' && ! isInstrumented ( handler . email ) ) {
120
115
handler . email = new Proxy ( handler . email , {
121
116
apply ( target , thisArg , args : Parameters < EmailExportedHandler < Env > > ) {
122
- const [ emailMessage , env , ctx ] = args ;
123
- const context = copyExecutionContext ( ctx ) ;
124
- args [ 2 ] = context ;
117
+ const [ emailMessage , env , context ] = args ;
125
118
return withIsolationScope ( isolationScope => {
126
119
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
127
120
const waitUntil = context . waitUntil . bind ( context ) ;
@@ -162,9 +155,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
162
155
if ( 'queue' in handler && typeof handler . queue === 'function' && ! isInstrumented ( handler . queue ) ) {
163
156
handler . queue = new Proxy ( handler . queue , {
164
157
apply ( target , thisArg , args : Parameters < ExportedHandlerQueueHandler < Env , QueueHandlerMessage > > ) {
165
- const [ batch , env , ctx ] = args ;
166
- const context = copyExecutionContext ( ctx ) ;
167
- args [ 2 ] = context ;
158
+ const [ batch , env , context ] = args ;
168
159
169
160
return withIsolationScope ( isolationScope => {
170
161
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
@@ -214,9 +205,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
214
205
if ( 'tail' in handler && typeof handler . tail === 'function' && ! isInstrumented ( handler . tail ) ) {
215
206
handler . tail = new Proxy ( handler . tail , {
216
207
apply ( target , thisArg , args : Parameters < ExportedHandlerTailHandler < Env > > ) {
217
- const [ , env , ctx ] = args ;
218
- const context = copyExecutionContext ( ctx ) ;
219
- args [ 2 ] = context ;
208
+ const [ , env , context ] = args ;
220
209
221
210
return withIsolationScope ( async isolationScope => {
222
211
const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
0 commit comments