Add support for Cloudflare Workflows
We've got some requests for supporting Cloudflare Workflows, so tracking this here.
https://developers.cloudflare.com/workflows/
Please upvote this issue and leave a comment if you want to see support for this functionality. Thanks!
Would love to see support for this! Workflows are an important part of our infrastructure and surfacing exceptions from them is really important.
Yes! Would love to see Workflows supported.
Alright thanks for the comments and reacts everyone! We're going to start working on this :)
We need this FEATURE! Please set a high priority for this one!
just my two cents for anyone who needs it NOW
you can still use Sentry using the browser version, you just have to call it at the beginning of your cron or workflow.
this is my implementation, a bit wordy but it works perfectly:
import * as SentryBrowser from '@sentry/browser';
import * as Sentry from '@sentry/cloudflare';
/**
* Init reporting clients
* @param root named parameters
* @param root.sentryDSN the DSN for Sentry (if not in the http worker)
*/
export function initReportingClients({
sentryDSN,
}: {
sentryDSN: string | undefined;
}): void {
// ...
if (sentryDSN) {
SentryBrowser.init({
attachStacktrace: true,
dsn: sentryDSN,
integrations: [
SentryBrowser.captureConsoleIntegration(),
SentryBrowser.extraErrorDataIntegration({
captureErrorCause: true,
depth: 10,
}),
],
// @ts-expect-error This is defined by the bundler
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- This is defined by the bundler
release: GITHUB_SHA,
sendDefaultPii: true,
tracesSampleRate: 1,
});
}
}
/**
* Capture an exception
* @param root named parameters
* @param root.error the error to capture
* @param root.userID the user ID
* @param root.additionalData additional data to send to the error tracking services
*/
export function captureException({
additionalData,
error,
userID,
}: {
additionalData?: { [key: string]: unknown };
error: unknown;
userID: string | undefined;
}): void {
if (Sentry.isEnabled()) {
Sentry.captureException(error, {
extra: additionalData,
user: userID
? {
id: userID,
}
: undefined,
});
} else if (SentryBrowser.isEnabled()) {
SentryBrowser.captureException(error, {
extra: additionalData,
user: userID
? {
id: userID,
}
: undefined,
});
} else {
logger.error('No error tracking service enabled!');
}
}
This will go out with the next release!
Great! Any ETA on when the next release is expected?
Wednesday afternoon at the latest
A PR closing this issue has just been released 🚀
This issue was referenced by PR #16672, which was included in the 9.32.0 release.
Docs are now live! https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/workflows/
and here's what it looks like: