fix(api): RPC handler collapses all errors to 500
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
The catch block in handleOrpcRequest in apps/api/src/rpc/handlers.ts (around lines 84-100) returns INTERNAL_SERVER_ERROR for every error, so start there and check how handleAppError() is already used elsewhere in that file. Route known ORPCError instances through handleAppError() while keeping the 500 fallback for unexpected errors. Done when a regression test covers the 401 and 404 paths and the existing RPC tests still pass.
Written by the indexing model from the issue text.
Description
Bug: ORPCError statuses are incorrectly returned as HTTP 500
Description
In apps/api/src/rpc/handlers.ts:84–100, handleOrpcRequest catches all errors thrown by createContext() or handle() and returns INTERNAL_SERVER_ERROR (HTTP 500), regardless of the original error.
Although the error is logged via recordORPCError(), it is never passed to handleAppError(). As a result, known ORPCError instances lose their original HTTP status and error code.
Impact
- Authentication failures (
401) and permission errors (403) are reported as server errors. - Not-found (
404), rate-limit (429), and payment-required (402) responses are incorrectly converted to500. - Clients may retry non-retryable requests unnecessarily.
- Error monitoring and alerting become less reliable because client errors are misclassified as server failures.
Expected Behavior
Known ORPCError instances should be passed through handleAppError() so their original error codes and HTTP statuses are preserved. Only genuinely unexpected errors should fall back to HTTP 500.
Acceptance Criteria
- Preserve original status codes and error codes for known
ORPCErrorinstances. - Add regression tests covering at least the
401and404paths. - Ensure unexpected errors still return HTTP
500. - Keep existing RPC tests passing.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 227
- Avg merge
- 23h 41m
- Merged PRs (30d)
- 250
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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 databuddy-analytics/Databuddy
-
Load docs analytics using Next.js ScriptPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 1-3 hours Newbie friendliness 74/100
databuddy-analytics/Databuddy#1147 ·
Maintainers usually reply within 1 day
-
Make the GTM documentation test compatible with Windows line endingsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
databuddy-analytics/Databuddy#1146 ·
Maintainers usually reply within 1 day
-
Fix locale-dependent number formatting on the pricing pagePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
databuddy-analytics/Databuddy#1145 ·
Maintainers usually reply within 1 day
-
fix(basket): redact sensitive params and keep query separators in batched outgoing link hrefsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
databuddy-analytics/Databuddy#1143 ·
Maintainers usually reply within 1 day
-
refactor(home): standardize "Install tracking" empty state using EmptyState componentPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
databuddy-analytics/Databuddy#1138 ·
Maintainers usually reply within 1 day
All issues in databuddy-analytics/Databuddy
Similar issues
-
frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
ranxianglei/billion-context#4172 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
awslabs/threat-composer#362 ·
Maintainers usually reply within 1 day
-
Area/Cloud Needs Triage Type/Bug
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
wso2/product-integrator#2847 ·
Maintainers usually reply within 1 day