({ event, resolve })
| 28 | setAsyncLocalStorageAsyncContextStrategy(); |
| 29 | |
| 30 | const handleInitSentry: Handle = ({ event, resolve }) => { |
| 31 | // if event.platform exists (should be there in a cloudflare worker), then do the cloudflare sentry init |
| 32 | if (event.platform) { |
| 33 | // This is an optional local that the `sentryHandle` handler checks for to avoid double isolation |
| 34 | // In Cloudflare the `wrapRequestHandler` function already takes care of |
| 35 | // - request isolation |
| 36 | // - trace continuation |
| 37 | // -setting the request onto the scope |
| 38 | addNonEnumerableProperty(event.locals, '_sentrySkipRequestIsolation', true); |
| 39 | return wrapRequestHandler( |
| 40 | { |
| 41 | options: opts, |
| 42 | request: event.request, |
| 43 | // @ts-expect-error This will exist in Cloudflare |
| 44 | context: event.platform.context, |
| 45 | // We don't want to capture errors here, as we want to capture them in the `sentryHandle` handler |
| 46 | // where we can distinguish between redirects and actual errors. |
| 47 | captureErrors: false, |
| 48 | }, |
| 49 | () => resolve(event), |
| 50 | ); |
| 51 | } |
| 52 | return resolve(event); |
| 53 | }; |
| 54 | |
| 55 | return handleInitSentry; |
| 56 | } |
nothing calls this directly
no test coverage detected