Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Send swallowed auth/migration DB errors to Sentry, and stop reporting routine 4xx

Đang mở
#554 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
backend, observability-sre

Hướng nghiên cứu

Bắt đầu với hook onError trong platform/src/server.ts:30-32, sau đó kiểm tra các lỗi bị nuốt trong server.ts:48 và instance-auth.ts:139 và :275. Đọc các chỗ sử dụng captureException hiện có trong instance-auth.ts và phần triển khai trong platform/src/util/sentry.ts. Hoàn tất có nghĩa là cả ba lỗi DB đều được ghi nhận, các lỗi 4xx thông thường được bỏ qua, còn các log và phản hồi HTTP hiện có vẫn không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug monitoring platform

Two related problems with how we report errors to Sentry.

First, three database failures in the client-auth path get logged with console.error and then forgotten. They never reach Sentry, so we're blind to them in production.

Second, the Elysia onError hook sends every error to Sentry, including routine 4xx like favicon bots hitting NOT_FOUND. That noise buries the errors we actually care about.

They sit in overlapping code, so it's easier to fix them together.

1. Capture the three swallowed DB errors. Each one currently console.errors and moves on:

  • platform/src/server.ts:48 — migration run failure (runMigrations()).
  • platform/src/auth/instance-auth.ts:139 — startup DB-probe (reachability) failure; auth degrades to the shape-checked forward path.
  • platform/src/auth/instance-auth.ts:275 — runtime client-lookup failure; request fails closed.

Each of these needs an explicit captureException(err, …) next to the log it already writes. captureException is already imported in instance-auth.ts:7 and used elsewhere in that file (lines 158, 251, 312), so those two sites are just inconsistent with the rest of it. server.ts needs the import adding (import { captureException } from "./util/sentry").

2. Skip 4xx in the onError hook. Request errors only reach Sentry through the onError hook at platform/src/server.ts:30-32, and it calls captureException(error) for everything. Add a status check so we only capture 5xx and unexpected errors, and skip the routine 4xx like NOT_FOUND. Elysia hands us the error code and status on the onError context, so the guard lives right there in the hook.

Sentry is wired in platform/src/util/sentry.ts (captureException is a no-op when SENTRY_DSN is unset) and initialised from platform/src/index.ts:4.

Acceptance criteria
  • Migration failure at platform/src/server.ts:48 calls captureException, with the import added to server.ts.
  • Startup DB-probe failure at platform/src/auth/instance-auth.ts:139 calls captureException.
  • Runtime client-lookup failure at platform/src/auth/instance-auth.ts:275 calls captureException.
  • The onError hook (platform/src/server.ts:30-32) only captures 5xx/unexpected errors; 4xx (e.g. NOT_FOUND) is skipped.
  • No behaviour change to the HTTP responses themselves — onError still returns nothing so Elysia produces its normal error body/status.
  • Existing log lines retained; Sentry capture is additive.
Ngôn ngữ chính
Jupyter Notebook
Star
5
Fork
10
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
16

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenFn/apollo

Tất cả issue của OpenFn/apollo

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.