Skip to content

Conversation

@chargome
Copy link
Member

Adds backend support for using the logs+metrics bundle in the JS loader

ref https://linear.app/getsentry/issue/JS-1465/support-logsmetrics-in-js-loader

@chargome chargome self-assigned this Jan 26, 2026
@linear
Copy link

linear bot commented Jan 26, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 26, 2026
if is_v7_sdk and not has_replay and not has_feedback:
# If we are loading replay, feedback, or logs+metrics, do not add the es5 modifier, as those
# bundles are ES6 only.
if is_v7_sdk and not has_replay and not has_feedback and not has_logs_and_metrics:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ES5 bundle incorrectly skipped for v7 SDK users

Medium Severity

The ES5 modifier condition incorrectly includes not has_logs_and_metrics. For v7 SDK users, logs+metrics bundles are never loaded (they require SDK >= 10.0.0), but if has_logs_and_metrics is True in the project settings, the ES5 modifier won't be added. This results in serving an ES6 bundle (bundle.min.js) instead of the required ES5 bundle (bundle.es5.min.js) for v7 SDK users, potentially causing compatibility issues in older browsers.

Fix in Cursor Fix in Web

@chargome chargome changed the title feat(js-loader): Support logs+metric bundle feat(js-loader): Support logs+metrics bundle Jan 26, 2026
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

config["autoInjectFeedback"] = True

if loader_config["hasLogsAndMetrics"]:
config["enableLogs"] = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableLogs config set for unsupported SDK versions

Medium Severity

The enableLogs config option is set in the SDK init config whenever hasLogsAndMetrics is true, but this lacks the SDK version check that exists elsewhere. The bundle modifier .logs.metrics is correctly gated behind is_greater_or_equal_v10_sdk, but the config setting isn't. When SDK < 10.0.0, users will get enableLogs: True in their config while receiving a bundle that doesn't support the feature, creating an inconsistency.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants