-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cloudflare): Add plugin for cloudflare pages #13123
Conversation
a793bd5
to
0499776
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
/** | ||
* | ||
* @param _options | ||
* @returns | ||
*/ | ||
export function sentryPagesPlugin< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L: You could add some docs here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thank you!
0499776
to
c7ac38c
Compare
size-limit report 📦
|
ref #12620
Before reviewing this PR, I recommend reading through a GH discussion I wrote up that explains the reasoning behind the API surface of the cloudflare SDK: #13007
The PR that adds Cloudflare Workers support is also helpful context: #13025
This PR adds support for Cloudflare Pages, Cloudflare's fullstack development deployment platform that is powered by Cloudflare Workers under the hood. Think of this platform having very similar capabilities (and constraints) as Vercel.
To set the plugin up, you do something like so:
We have to use the middleware instead of a global init because we need to call
init
for every single new incoming request to make sure the sentry instance does not get stale with redeployments.While implementing
sentryPagesPlugin
, I noticed that there was a logic that was redundant between it andwithSentry
, the API for cloudflare workers.This led me to refactor this into a common helper,
wrapRequestHandler
, which is contained inpackages/cloudflare/src/request.ts
. That is why there is diffs in this PR forpackages/cloudflare/src/handler.ts
.