File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,27 @@ export const onRequest = Sentry.sentryPagesPlugin(context => ({
82
82
}));
83
83
```
84
84
85
+ If you do not have access to the ` onRequest ` middleware API, you can use the ` wrapRequestHandler ` API instead.
86
+
87
+ Here is an example with SvelteKit:
88
+
89
+ ``` javascript
90
+ // hooks.server.js
91
+ import * as Sentry from ' @sentry/cloudflare' ;
92
+
93
+ export const handle = ({ event , resolve }) => {
94
+ const requestHandlerOptions = {
95
+ options: {
96
+ dsn: event .platform .env .SENTRY_DSN ,
97
+ tracesSampleRate: 1.0 ,
98
+ },
99
+ request: event .request ,
100
+ context: event .platform .ctx ,
101
+ }
102
+ return Sentry .wrapRequestHandler (requestHandlerOptions, () => resolve (event ));
103
+ };
104
+ ```
105
+
85
106
## Setup (Cloudflare Workers)
86
107
87
108
To use this SDK, wrap your handler with the ` withSentry ` function. This will initialize the SDK and hook into the
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ export {
88
88
export { withSentry } from './handler' ;
89
89
export { sentryPagesPlugin } from './pages-plugin' ;
90
90
91
+ export { wrapRequestHandler } from './request' ;
92
+
91
93
export { CloudflareClient } from './client' ;
92
94
export { getDefaultIntegrations } from './sdk' ;
93
95
You can’t perform that action at this time.
0 commit comments