Skip to content

feat(client): add BetterBugs recording links with airgap and disable …#41576

Merged
sebastianiv21 merged 1 commit intoreleasefrom
feat/add-betterbugs-recording-links
Feb 26, 2026
Merged

feat(client): add BetterBugs recording links with airgap and disable …#41576
sebastianiv21 merged 1 commit intoreleasefrom
feat/add-betterbugs-recording-links

Conversation

@sebastianiv21
Copy link
Contributor

@sebastianiv21 sebastianiv21 commented Feb 25, 2026

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

…support

  • Inject logs-capture.js and recorder.js in index.html when BetterBugs is enabled and not airgapped; respect APPSMITH_DISABLE_BETTERBUGS and APPSMITH_AIRGAP_ENABLED
  • Set __BetterbugsRecordingLinkConfig with default primaryColor #E15615 and success copy aligned with in-app widget
  • Declare DISABLE_BETTERBUGS once in head and remove duplicate in body to fix redeclaration error
  • Add JSDoc in betterbugs.ts noting recording-link scripts are loaded in index.html

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/22415681310
Commit: 47e9bc5
Cypress dashboard.
Tags: @tag.All
Spec:


Wed, 25 Feb 2026 22:45:26 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Chores

    • Updated BetterBugs recording script configuration to support conditional loading based on environment settings, improving configuration management and eliminating duplicate variable declarations.
  • Documentation

    • Added comprehensive documentation describing BetterBugs in-app recording functionality, including details on script loading behavior and when features activate.

…support

- Inject logs-capture.js and recorder.js in index.html when BetterBugs is
  enabled and not airgapped; respect APPSMITH_DISABLE_BETTERBUGS and
  APPSMITH_AIRGAP_ENABLED
- Set __BetterbugsRecordingLinkConfig with default primaryColor #E15615 and
  success copy aligned with in-app widget
- Sync recording-link config styles from betterbugs.ts on init so branding
  (e.g. --ads-v2-color-bg-brand) matches the widget
- Declare DISABLE_BETTERBUGS once in head and remove duplicate in body to
  fix redeclaration error
- Add JSDoc in betterbugs.ts noting recording-link scripts are loaded in
  index.html
@sebastianiv21 sebastianiv21 added the ok-to-test Required label for CI label Feb 25, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Walkthrough

The change reorganizes BetterBugs initialization by moving the DISABLE_BETTERBUGS constant declaration earlier in the HTML index file and introducing conditional script loading based on environment configuration. A documentation comment is added to the BetterbugsMetadata interface.

Changes

Cohort / File(s) Summary
HTML Configuration Reorganization
app/client/public/index.html
Moved DISABLE_BETTERBUGS constant declaration to the first config script, eliminated duplicate declaration in later block, and added conditional BetterBugs recording script loading based on enabled status and airgap detection.
Documentation Additions
app/client/src/utils/Analytics/betterbugs.ts
Added descriptive comment explaining BetterBugs in-app widget functionality, recording-link scripts, and their conditional loading behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes


🐛 A constant climbs to the top,
Scripts load when they ought—no flop,
BetterBugs recorded with care,
Configuration streamlined and fair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. The 'Fixes' field contains only a placeholder without an actual issue number or URL, and DevRel/Marketing communication preference is not selected. Replace the 'Fixes' placeholder with the actual issue number or URL, and select either 'Yes' or 'No' for the DevRel/Marketing communication checkbox.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding BetterBugs recording links with support for airgap and disable configurations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-betterbugs-recording-links

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sebastianiv21
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/22415759198.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41576.
recreate: .

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/client/public/index.html`:
- Around line 76-96: The BetterBugs snippet uses mutable CDN "/latest/" URLs
(s1.src and s2.src) which makes builds non-deterministic; replace the dynamic
<script> injection by installing and importing the pinned npm package
`@betterbugs/web-sdk` (or using self-hosted vetted copies) and initialize it using
the existing window.__BetterbugsRecordingLinkConfig settings (the same config
object name) instead of loading
"https://cdn.betterbugs.io/scripts/latest/logs-capture.js" and "recorder.js";
update package.json to pin the version, remove the runtime creation of s1/s2,
and call the SDK init/start functions from your bundled client bootstrap code
where window.__BetterbugsRecordingLinkConfig is still applied.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 55ac824 and 47e9bc5.

📒 Files selected for processing (2)
  • app/client/public/index.html
  • app/client/src/utils/Analytics/betterbugs.ts

Comment on lines +76 to +96
<!-- Start of BetterBugs Recording Links (logs + recorder; only when BetterBugs enabled and not airgapped) -->
<script type="text/javascript">
if (!DISABLE_BETTERBUGS && !AIRGAPPED) {
window.__BetterbugsRecordingLinkConfig = {
styles: { theme: "light", primaryColor: "#E15615", primaryTextColor: "#ffffff" },
successMessageHeaderText: "Information received",
successMessageSubHeaderText: "Our support team will use it to review the issue",
};
(function () {
var s1 = document.createElement("script");
s1.src = "https://cdn.betterbugs.io/scripts/latest/logs-capture.js";
s1.async = true;
document.head.appendChild(s1);
var s2 = document.createElement("script");
s2.src = "https://cdn.betterbugs.io/scripts/latest/recorder.js";
s2.async = true;
document.head.appendChild(s2);
})();
}
</script>
<!-- End of BetterBugs Recording Links -->
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

BetterBugs CDN logs-capture.js recorder.js version pinned URLs SRI

💡 Result:

BetterBugs’ own docs currently instruct loading these mutable (“latest”) CDN assets (so you can’t safely “pin” + SRI them unless BetterBugs also offers immutable, versioned file URLs):

  • https://cdn.betterbugs.io/scripts/latest/logs-capture.js
  • https://cdn.betterbugs.io/scripts/latest/recorder.js [1]

What that means for “version-pinned URLs + SRI”

  • SRI only makes sense with an immutable URL (a URL whose content won’t change). If the path contains latest, the bytes can change at any time, so an SRI hash will either break unexpectedly (when BetterBugs updates) or you’ll be forced to constantly update the hash. This is why vendors that support SRI typically document version-specific URLs (e.g., /…/3.10.4/…) and then provide (or let you compute) an integrity hash for that exact version. [2]

Practical options

  1. Ask BetterBugs support whether they have versioned/immutable URLs like:
    https://cdn.betterbugs.io/scripts/<version>/logs-capture.js and …/recorder.js
    (and whether they publish SRI hashes for each release).
  2. If they don’t offer versioned URLs, use one of these approaches:
    • Self-host the exact JS files you’ve vetted (then you can pin via your own deploy process).
    • Or keep using latest without SRI, accepting vendor-driven updates (their documented default). [1]

If you tell me your deployment preference (self-host vs CDN) and whether BetterBugs provides any versioned script paths in your dashboard/UI, I can give you the exact snippet format to use (including integrity/crossorigin) for your chosen setup.

Sources: [1] BetterBugs “Recording Links” docs (shows the latest CDN script URLs). [2] TrackJS SRI guidance (explains using version-specific URLs for SRI).


🌐 Web query:

BetterBugs official documentation CDN scripts versioning

💡 Result:

BetterBugs’ official Web SDK CDN install snippet uses a “moving” alias (no pinned version in the URL):

  • <script src="https://cdn.betterbugs.io/scripts/latest/index.js"></script> (loads the latest build). [1]

In the official docs, there isn’t any documented alternative CDN URL format for pinning a specific version (e.g., /scripts/1.2.3/...)—only the /latest/ path is shown. [1]

If you need explicit versioning / reproducible builds, the docs recommend installing the SDK via npm/yarn, where you can pin a semver version in package.json:

  • npm install @betterbugs/web-sdk / `yarn add `@betterbugs/web-sdk [2]
  • The package is published on npm (e.g., jsDelivr shows version 0.0.40 at the time it was crawled). [3]

Sources: [1] BetterBugs Doc – “Start widget with CDN Script” • [2] BetterBugs Doc – “Start widget with npm or yarn” • [3] jsDelivr – @betterbugs/web-sdk package page


Use npm/yarn to pin BetterBugs SDK version instead of mutable CDN /latest/ paths.

Lines 86 and 90 load third-party scripts from https://cdn.betterbugs.io/scripts/latest/..., which are non-deterministic and weaken supply-chain control. BetterBugs' official CDN does not offer versioned URLs (e.g., /scripts/1.2.3/...). For reproducible builds, migrate to the npm package (@betterbugs/web-sdk) and pin the version in package.json, or self-host the vetted scripts from your own infrastructure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/client/public/index.html` around lines 76 - 96, The BetterBugs snippet
uses mutable CDN "/latest/" URLs (s1.src and s2.src) which makes builds
non-deterministic; replace the dynamic <script> injection by installing and
importing the pinned npm package `@betterbugs/web-sdk` (or using self-hosted
vetted copies) and initialize it using the existing
window.__BetterbugsRecordingLinkConfig settings (the same config object name)
instead of loading "https://cdn.betterbugs.io/scripts/latest/logs-capture.js"
and "recorder.js"; update package.json to pin the version, remove the runtime
creation of s1/s2, and call the SDK init/start functions from your bundled
client bootstrap code where window.__BetterbugsRecordingLinkConfig is still
applied.

@github-actions
Copy link

Deploy-Preview-URL: https://ce-41576.dp.appsmith.com

Copy link
Contributor

@tomjose92 tomjose92 left a comment

Choose a reason for hiding this comment

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

Changes look good

@sebastianiv21 sebastianiv21 merged commit f13026c into release Feb 26, 2026
154 of 156 checks passed
@sebastianiv21 sebastianiv21 deleted the feat/add-betterbugs-recording-links branch February 26, 2026 17:42
@sebastianiv21 sebastianiv21 restored the feat/add-betterbugs-recording-links branch February 26, 2026 18:19
@sebastianiv21 sebastianiv21 deleted the feat/add-betterbugs-recording-links branch February 27, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants