Loader stub silently drops calls outside queued method list, which results in either silent no-ops
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Bắt đầu bằng cách đọc packages/browser-integration-tests/fixtures/loader.js để theo dõi hàng đợi phương thức trước khi tải, sau đó so sánh các mục trong đó với phần triển khai addIntegration trong packages/core/src/integration.ts. Xác nhận cách các lệnh gọi đã được xếp hàng được phát lại sau khi tải, đồng thời kiểm tra rằng cơ chế bảo vệ đã chọn xử lý addIntegration mà không thay đổi các phương thức hiện có trong hàng đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
Problem
The CDN loader stub only queues a fixed set of SDK methods pre-load (init, addBreadcrumb, captureMessage, captureException, captureEvent, configureScope, withScope, showReportDialog). Any SDK call outside this list — such as addIntegration — is silently absent on the window.Sentry proxy before the full bundle loads, causing either silent no-ops or runtime crashes depending on timing.
The correct workaround is wrapping such calls in Sentry.onLoad(...), but the loader provides no mechanism to enforce this, making it easy to write code that works in development (where the bundle may already be loaded) but crashes in production.
Current Behavior
- Unrecognized calls on the pre-load proxy are
undefined— calling them throws or silently does nothing addIntegrationis a notable gap: it is a common post-init call pattern that the loader stub does not queue
Gap
- No TypeScript or runtime guardrail prevents calling unqueued methods before
onLoad - The failure mode is timing-dependent and hard to reproduce locally
Solution Brainstorm
Options
- Extend the queued method list — add
addIntegration(and other commonly used post-init methods) to the pre-load queue so they are replayed after the bundle loads, consistent with howinitis handled - Catch-all no-op proxy — intercept any unrecognized property access pre-load and return a no-op function; prevents crashes but silently swallows calls
- Catch-all replay proxy — queue all unrecognized calls (not just the fixed list) and attempt replay post-load; broader coverage but requires more careful handling of methods with return values
Option 1 is the lowest-risk and most targeted fix. Option 3 is the most ergonomic for callers but adds complexity to the replay logic.
Additional Context
References
- Loader stub source:
packages/browser-integration-tests/fixtures/loader.js addIntegrationimplementation:packages/core/src/integration.ts
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 8.7k
- Fork
- 1.9k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 562
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-javascript
-
Browser Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
getsentry/sentry-javascript#24577 · 1 bình luận ·
-
Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-javascript#24558 · 1 bình luận ·
-
Task
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
getsentry/sentry-javascript#24557 · 1 bình luận ·
-
Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
getsentry/sentry-javascript#24556 · 1 bình luận ·
-
Task
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
getsentry/sentry-javascript#24555 · 1 bình luận ·
Tất cả issue của getsentry/sentry-javascript
Issue tương tự
-
blocklist removal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
pastelsky/bundlephobia#1122 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100