-
-
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
Sentry Cloudflare Workers SDK #12620
Comments
Initial thinking of the general API. We're probably only going to support Current toucan requires you to always instantiate It would probably automatically try to read export default withSentry({ beforeSend }, {
async fetch(request, env, ctx) {
return new Response('Hello World!');
},
}); For further customization, you can take a function export default withSentry({ tracesSampleRate: 1.0 }, {
async fetch: withSentryFetchHandler((init) => (request, env, ctx) => {
const client = init({ tracesSampleRate: 0.5, request, env, ctx });
// do whatever you want with client
return new Response('Hello World!');
}),
}); With the If you don't want any import * as Sentry from '@sentry/cloudflare-workers';
export default {
async fetch(request, env, ctx) {
const client = new Sentry.CloudflareWorkersClient();
const scope = new Sentry.Scope();
scope.setClient(client);
try {
handler();
return new Response('Hello!');
} catch (e) {
scope.captureException(e);
return new Response('Something went wrong! Team has been notified.', {
status: 500,
});
}
},
}; Unfortunately performance is not active here because the parent child relationship is wrong, so maybe we gate performance behind requiring We also need to add support for Version metadata binding - I'm imagining this is easiest to expose as an |
I'm throwing around some experiments in https://github.com/AbhiPrasad/sentry-cloudflare-test/tree/main/examples |
Hey @AbhiPrasad, by adding support for Cloudflare Workers, do you also plan to add support for Cloudflare Pages? I know CF are working on unifying the two platforms, but it's still "a bit out there" (at least according to their Discord) and there are some subtle differences to how they work. Anyways, awesome that you are doing this! 😄 I've been looking forward to official support for a long time! |
Yes for sure, this is def part of it because this is how all the metaframework integrations work. Let me make it more clear in the tracking issue, and also add some example of API design for that too. |
Does this include Astro? 👀 I know there is already an Like everyone else said, im also super happy that this is being worked on :) |
Yes! At the beginning you might have to manually add |
Durable objects run in a separate isolate with their own Cloudflare workers also has:
It would be great to have tracing work across all these boundaries too! |
We need a different exported method.
Adding to the todo! |
Hey, I'm sure you are very busy but let me know if you need anything else from me to help with this issue. Thanks! |
Hey, sorry there hasn't been an update yet. We're having some people out of office, but this should get picked up soon/this week. |
No worries, thanks for the update 👍 |
ref getsentry/sentry-javascript#12620 Adds cloudflare as a backend platform.
ref getsentry/sentry-javascript#12620 Adds cloudflare as a backend platform.
ref getsentry/sentry-javascript#12620 Adds cloudflare as a backend platform.
Removes alpha note from cloudflare sdk readme. ref #12620
ref #2484
ref #5611
Let's add some 1st class cloudflare workers support (finally)!
We've had https://github.com/robertcepa/toucan-js for a while that has worked great, but doesn't match our unified API and doesn't have full support for performance, cron monitoring, and more.
First we can start off by making a basic package,
@sentry/cloudflare-workers
Initial
withSentry
method #13025After First Release
@sentry/cloudflare
to the release registry sentry-release-registry#164Once the SDK is in a good state we can think about better instrumentation for the different bindings that cloudflare workers exposes. Top of mind is:
Bindings support
At the same time we should make sure that we add support for our metaframeworks to use the Cloudflare workers SDK
Support metaframeworks
The text was updated successfully, but these errors were encountered: