feat(client): add BetterBugs recording links with airgap and disable …#41576
feat(client): add BetterBugs recording links with airgap and disable …#41576sebastianiv21 merged 1 commit intoreleasefrom
Conversation
…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
WalkthroughThe change reorganizes BetterBugs initialization by moving the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
|
/build-deploy-preview skip-tests=true |
|
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/22415759198. |
There was a problem hiding this comment.
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.
| <!-- 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 --> |
There was a problem hiding this comment.
🧩 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.jshttps://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
- Ask BetterBugs support whether they have versioned/immutable URLs like:
https://cdn.betterbugs.io/scripts/<version>/logs-capture.jsand…/recorder.js
(and whether they publish SRI hashes for each release). - 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
latestwithout 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.40at 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.
|
Deploy-Preview-URL: https://ce-41576.dp.appsmith.com |
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
Fixes #
Issue Numberor
Fixes
Issue URLWarning
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.AllSpec:
Wed, 25 Feb 2026 22:45:26 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Chores
Documentation