Cloudflare capture crashes / data before we export the default fetch handler
@JPeer264 is already working on this.
Since Sep 14, 2026.
Assessment
This issue has not been assessed yet.
Description
Problem Statement
Potentially the following Error would never be seen within Sentry:
// file:src/index.ts
import diagnostics_channel from 'diagnostics_channel';
const channel = diagnostics_channel.channel('my-channel');
const app = new Hono();
// never been seen by Sentry
throw new Error();
// never been seen by Sentry
channel.publish({
some: 'data',
});
export default {
fetch: app.fetch,
scheduled: async (batch, env) => {},
}
Solution Brainstorm
Since we introduced cachedClients #23151 we could potentially inject an Sentry.init at the top of the workers entrypoint with Vite:
// file:src/index.ts
// following is being injected automatically and uses `Sentry.init`
import ./instrument.js`;
// ... the rest from above ...
Theoretically, instrument.js only sets up the client so we receive some data, and later the withSentry wrapped code would wrap everything as usual and reuses the previously created client.
Additional Context
This would only work with the v11's default cacheClient: true and the entrypoint would not be added when cacheClient: false
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
- Dominant language
- TypeScript
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 543
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from getsentry/sentry-javascript
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Task
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-javascript#24558 · 1 comment ·
-
Task
Difficulty 1/5 Under an hour Newbie friendliness 90/100
getsentry/sentry-javascript#24557 · 1 comment ·
-
Task
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
getsentry/sentry-javascript#24556 · 1 comment ·
-
Task
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
getsentry/sentry-javascript#24555 · 1 comment ·
All issues in getsentry/sentry-javascript
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vicharanashala/fln#563 ·