Repository navigation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/cloudflare
SDK Version
10.3.0
Framework Version
No response
Link to Sentry event
Reproduction Example/SDK Setup
Nested manual spans as described here: https://docs.sentry.io/platforms/javascript/guides/cloudflare/tracing/span-metrics/#creating-dedicated-metric-spans are not showing up in error traces.
I'm facing some deep issues in my workflows, and using the spans to debug what is happening. To do so, I'm nesting spans (one span for multiple step.do that are related)
The issue is none of those nested span are showing up in the dashboard, making it impossible to track what is going on
Steps to Reproduce
class WorkflowIngestBase extends WorkflowEntrypoint<
Cloudflare.Env,
IngestionWorkflowParameters
> {
async run(
event: WorkflowEvent<IngestionWorkflowParameters>,
step: WorkflowStep,
): Promise<void> {
const page = step.do('fetch page'() => {...})
for (const item in page.item){
Sentry.startSpan(
{
name: 'my custom span',
attributes: {
pageID: page.id,
}
},
async () => {
await step.do('process page item', async () => {...})
await step.do('save item', async () => {...})
}
);
}
}
}
export const WorkflowIngest = SentryCloudflare.instrumentWorkflowWithSentry(
(_environment: Cloudflare.Env) => {
return {
dsn: '...',
...customSentryConfig,
};
},
WorkflowIngestBase,
);Expected Result
(in Sentry)
Trace
|- step.do fetch page
|- my custom span
| |- step.do process item
| |- step.do save item
|- my custom span
| |- step.do process item
| |- step.do save item
| ...
Actual Result
(in Sentry)
Trace
|- step.do fetch page
|- step.do process item
|- step.do save item
|- step.do process item
|- step.do save item
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
linear commentedon Aug 14, 2025
JS-868 [Cloudflare workflows] Dedicated span do not show up in error reports
Lms24 commentedon Aug 18, 2025
Hey @Mael-Abgrall thanks for writing in! Quick heads-up: We're having an internal hackathon this week ("Hackweek"). Therefore, we'll likely only look at this next week in detail.
s1gr1d commentedon Sep 10, 2025
Hello, thanks for writing in!
Our implementation was creating a new Sentry client for each
step.doand that reseted the tracing context and the span started withstartSpanwas never exported to Sentry. I fixed this behavior in this PR and it should look like this when it is merged :)fix(cloudflare): Initialize once per workflow run and preserve scope …
s1gr1d commentedon Sep 11, 2025
In general, this is fixed in the next release but creating a span outside the workflow is not recommended.
See this comment from the Cloudflare Workflow team: #17582 (comment)
If you are pretty sure that your workflow won't hibernate, you can probably leave the "outer"
startSpan.We'll also reflect this in the docs (PR): https://docs.sentry.io/platforms/javascript/guides/cloudflare/features/workflows/
docs(cloudflare): Add notice about spans Workflows (#14880)
github-actions commentedon Sep 16, 2025
A PR closing this issue has just been released 🚀
This issue was referenced by PR #17582, which was included in the 10.12.0 release.
Mael-Abgrall commentedon Sep 17, 2025
@s1gr1d that is great insights, thank you for following up with cloudflare's team :)
And I also did found out that errors outside of step.do where not caught
fantastic thank you!