fix(event): auto-fallback to org-wide search when event 404s in project#575
fix(event): auto-fallback to org-wide search when event 404s in project#575
Conversation
When `event view` gets a 404 from the project-scoped endpoint, it now automatically tries `resolveEventInOrg()` to search across all projects in the org before throwing a ResolutionError. This handles the common case where DSN auto-detection or config defaults resolve to the wrong project within the correct org. The user sees a warning about the redirect: Event not found in my-org/my-project, but found in my-org/other-project. If the org-wide search also fails, the original ResolutionError with suggestions is shown (unchanged behavior). Fixes CLI-KW (9 users, 12 events in 0.20.0)
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Dashboard
Init
Other
Bug Fixes 🐛Dashboard
Other
Internal Changes 🔧Coverage
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 126 passed | Total: 126 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1276 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.43% 95.43% —%
==========================================
Files 194 194 —
Lines 27894 27921 +27
Branches 0 0 —
==========================================
+ Hits 26620 26645 +25
- Misses 1274 1276 +2
- Partials 0 0 —Generated by Codecov Action |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Address Cursor Bugbot feedback: 1. Wrap resolveEventInOrg in try-catch so non-404 errors (500, network) don't mask the helpful ResolutionError with suggestions 2. Replace redundant 'search across all projects' suggestion with 'event was not found in any project' since we already tried the org-wide search
|
Addressed both Cursor Bugbot findings in a20a6c3:
|

Summary
When
sentry event view my-org/my-project <event-id>returns a 404, it typically means the event exists in a different project within the same org (e.g., DSN auto-detection picked the wrong project).Previously, the user got a
ResolutionErrorwith a suggestion to trysentry event view my-org/ <event-id>(org-wide search). This required a second manual invocation.Fix
Now
fetchEventWithContext()automatically triesresolveEventInOrg()when the project-scoped fetch returns 404. If the event is found in another project, it's returned with a warning:If the org-wide search also fails, the original
ResolutionErrorwith suggestions is shown (unchanged behavior).Sentry Issue
Fixes CLI-KW (9 users, 12 events in 0.20.0)
Changes
src/commands/event/view.ts: Added cross-project fallback infetchEventWithContext(), exported function for testingtest/commands/event/view.test.ts: Added 5 tests covering the fallback scenarios