@@ -14,7 +14,6 @@ import { getFinalOptions } from './options';
1414import { wrapRequestHandler } from './request' ;
1515import { addCloudResourceContext } from './scope-utils' ;
1616import { init } from './sdk' ;
17- import { copyExecutionContext } from './utils/copyExecutionContext' ;
1817
1918/**
2019 * Wrapper for Cloudflare handlers.
@@ -38,11 +37,9 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
3837 if ( 'fetch' in handler && typeof handler . fetch === 'function' && ! isInstrumented ( handler . fetch ) ) {
3938 handler . fetch = new Proxy ( handler . fetch , {
4039 apply ( target , thisArg , args : Parameters < ExportedHandlerFetchHandler < Env , CfHostMetadata > > ) {
41- const [ request , env , ctx ] = args ;
40+ const [ request , env , context ] = args ;
4241
4342 const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
44- const context = copyExecutionContext ( ctx ) ;
45- args [ 2 ] = context ;
4643
4744 return wrapRequestHandler ( { options, request, context } , ( ) => target . apply ( thisArg , args ) ) ;
4845 } ,
@@ -74,9 +71,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
7471 if ( 'scheduled' in handler && typeof handler . scheduled === 'function' && ! isInstrumented ( handler . scheduled ) ) {
7572 handler . scheduled = new Proxy ( handler . scheduled , {
7673 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 ;
8075 return withIsolationScope ( isolationScope => {
8176 const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
8277 const waitUntil = context . waitUntil . bind ( context ) ;
@@ -119,9 +114,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
119114 if ( 'email' in handler && typeof handler . email === 'function' && ! isInstrumented ( handler . email ) ) {
120115 handler . email = new Proxy ( handler . email , {
121116 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 ;
125118 return withIsolationScope ( isolationScope => {
126119 const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
127120 const waitUntil = context . waitUntil . bind ( context ) ;
@@ -162,9 +155,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
162155 if ( 'queue' in handler && typeof handler . queue === 'function' && ! isInstrumented ( handler . queue ) ) {
163156 handler . queue = new Proxy ( handler . queue , {
164157 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 ;
168159
169160 return withIsolationScope ( isolationScope => {
170161 const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
@@ -214,9 +205,7 @@ export function withSentry<Env = unknown, QueueHandlerMessage = unknown, CfHostM
214205 if ( 'tail' in handler && typeof handler . tail === 'function' && ! isInstrumented ( handler . tail ) ) {
215206 handler . tail = new Proxy ( handler . tail , {
216207 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 ;
220209
221210 return withIsolationScope ( async isolationScope => {
222211 const options = getFinalOptions ( optionsCallback ( env ) , env ) ;
0 commit comments