-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
d996c22
commit 07a30e5
Showing
4 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters