You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cloudflare): Allow users to pass handler to sentryPagesPlugin (#13192)
While working on adding the cloudflare sdk to some open source projects,
I noticed that setup for the cloudflare plugin was a bit of a hassle
when you needed access to environmental variables.
This PR allows users to pass a function to `sentryPagesPlugin` that
looks like so:
```ts
handler: (context: EventPluginContext<Env, Params, Data, PluginParams>) => CloudflareOptions
```
This means that users can access the cloudflare `context` (which only
exists at the request level) to get environmental variables.
```javascript
export const onRequest = Sentry.sentryPagesPlugin(context => ({
dsn: context.env.SENTRY_DSN,
tracesSampleRate: 1.0,
}));
```
To make some other use cases easier, this PR also exposes the
`wrapRequestHandler` API to users.
0 commit comments