Skip to content

feat: Add Betterbugs SDK support#41532

Open
sebastianiv21 wants to merge 8 commits intoreleasefrom
feat/add-betterbugs-support
Open

feat: Add Betterbugs SDK support#41532
sebastianiv21 wants to merge 8 commits intoreleasefrom
feat/add-betterbugs-support

Conversation

@sebastianiv21
Copy link
Contributor

@sebastianiv21 sebastianiv21 commented Jan 27, 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.

This PR integrates Betterbugs bug reporting SDK into the Appsmith client application, providing users with an enhanced bug reporting experience directly within the application interface.

Motivation and Context
Currently, users need to manually report bugs through external channels, which can be cumbersome and may result in incomplete bug reports. By integrating Betterbugs, we enable:

  • Streamlined bug reporting: Users can report bugs directly from the application
  • Rich context capture: Automatically captures session metadata, user information, and application state
  • Better debugging: Provides development team with comprehensive bug reports including screenshots, console logs, and user actions
  • Improved user experience: Reduces friction in the bug reporting process

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=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD 9a9320a yet


Thu, 05 Feb 2026 19:35:02 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Adds a visible "Send support info" option in help menus and homepage header (shown when enabled) to let users send diagnostic/support info.
  • Chores

    • Integrates a third‑party support widget and SDK, adds a feature‑flagged configuration with an API key toggle, wires build/deploy and runtime settings, and updates widget metadata automatically on navigation.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Walkthrough

Adds Betterbugs frontend integration: dependency, build/env wiring, config types, a Betterbugs SDK wrapper (BetterbugsUtil), UI menu triggers to open the widget, route-change metadata updates, and nginx/jest substitutions.

Changes

Cohort / File(s) Summary
Dependency
app/client/package.json
Adds @betterbugs/web-sdk ^0.0.40.
Feature flags & public config
app/client/jest.config.js, app/client/public/index.html, app/client/docker/templates/nginx-app.conf.template
Adds betterbugs entries to APPSMITH_FEATURE_CONFIGS, a DISABLE_BETTERBUGS substitution flag, and nginx sub_filter for BETTERBUGS flag.
Build / CI / Docker
Dockerfile, .github/workflows/... (multiple), scripts/deploy_preview.sh
Wires APPSMITH_BETTERBUGS_API_KEY as ARG/ENV and adds it to CI/workflow build-args and deploy preview Helm values.
Config types & wiring
app/client/src/ce/configs/index.ts, app/client/src/ce/configs/types.ts
Adds betterbugs config (apiKey) to injected env mapping and extends AppsmithUIConfigs with betterbugs: { enabled, apiKey }.
New SDK wrapper
app/client/src/utils/Analytics/betterbugs.ts
New BetterbugsUtil: dynamic import of SDK, singleton widget lifecycle (init/show/hide/destroy/updateMetadata), runtime metadata collection, airgap/enable checks, and metadata syncing.
UI triggers
app/client/src/pages/Editor/HelpButton.tsx, app/client/src/pages/common/SearchBar/HomepageHeaderAction.tsx
Adds "Send support info" menu items (icon support) shown when betterbugs.enabled and non-airgapped; items call BetterbugsUtil.show(user).
Routing integration
app/client/src/RouteChangeListener.tsx
Calls BetterbugsUtil.updateMetadata() on route changes to refresh runtime metadata.
Messages
app/client/src/ce/constants/messages.ts
Adds SEND_SUPPORT_INFO message constant used by new UI items.
Tests / Jest config
app/client/jest.config.js
Exposes betterbugs.apiKey in globals for test/runtime substitution.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant UI as "Help / Homepage Menu"
    participant Config as "App Configs"
    participant Util as "BetterbugsUtil"
    participant SDK as "@betterbugs/web-sdk"
    participant Router as "RouteChangeListener"

    User->>UI: Click "Send support info"
    UI->>Config: read betterbugs.enabled, apiKey
    UI->>Util: show(user)
    Util->>Util: destroy existing instance (if any)
    Util->>Config: read apiKey, appVersion, tenantId, runtime metadata
    Util->>SDK: dynamic import (browser)
    SDK-->>Util: module loaded
    Util->>SDK: create widget with user, metadata, styles
    SDK-->>Util: instance created
    Util->>SDK: openWidget()
    SDK-->>User: Widget displayed

    Note over Router,Util: On route change
    Router->>Util: updateMetadata()
    Util->>SDK: setMetadata(updatedRuntimeMetadata)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐞 A tiny widget wakes and hums,
Click "Send support info" — the message comes,
Metadata bundled, routes in tow,
A debug beacon set to glow,
Help arrives where problems roam.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description includes motivation, context, and benefits of the Betterbugs integration, but lacks issue reference and dependencies listing that the template requires. Replace 'Fixes #Issue Number' placeholder with actual issue number/URL and list any external dependencies or related Betterbugs documentation links.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Add Betterbugs SDK support' accurately summarizes the main change - integrating the Betterbugs SDK into the Appsmith client application.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-betterbugs-support

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 sebastianiv21 changed the title Feat/add betterbugs support feat: Add Betterbugs SDK support Jan 27, 2026
@github-actions github-actions bot added the Enhancement New feature or request label Jan 27, 2026
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: 2

🤖 Fix all issues with AI agents
In `@app/client/src/pages/common/SearchBar/HomepageHeaderAction.tsx`:
- Around line 146-153: Only render the "Send support info" MenuItem when
Betterbugs is enabled and has a valid API key, and localize its label via
createMessage; update the JSX in HomepageHeaderAction to conditionally include
the <MenuItem> that calls BetterbugsUtil.show(user) by checking the Betterbugs
config flag or API key presence (use whatever config accessor exists in this
component), and replace the hardcoded text with createMessage({ id: '...',
defaultMessage: 'Send support info' }) to match other menu items.

In `@app/client/src/pages/Editor/HelpButton.tsx`:
- Line 42: The menu item for "Send support info" is added and the BetterBugs SDK
is invoked unconditionally; update the HelpButton component to only render the
menu item when the feature flag is enabled (check the app config or
betterbugs.enabled) and guard the click handler to no-op if Betterbugs isn't
configured. Concretely: in HelpButton (where the menu is built / renderMenu or
addMenuItem is called) wrap the menu-item creation in a conditional that checks
betterbugs.enabled (or call a helper like BetterbugsUtil.isEnabled()), and in
the sendSupportInfo / onSendSupportInfo handler call BetterbugsUtil only after
verifying BetterbugsUtil.isEnabled() or API key presence; if not enabled, return
early (and optionally log a debug message) so the SDK is never triggered when no
API key is configured.

@tomjose92
Copy link
Contributor

@sebastianiv21 , we need to have an option to allow the user to disable betterbugs. This is in scenarios where its airgapped, or the user has hosted in an isolated environment and does not want to outgoing traffic to betterbugs.
Or wouldnt whitelist it. It will throw up a lot of console errors or failed network

);

const betterbugs = getConfig(
ENV_CONFIG.betterbugs.apiKey,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have a way to control this from env configuration, so that it can be disabled.
Or test and see what happens if we set it up an environment that does not have outgoing access. Would it keep throwing errors.

@tomjose92
Copy link
Contributor

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

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

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

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

@sebastianiv21
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

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

@github-actions
Copy link

github-actions bot commented Feb 4, 2026

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

@sebastianiv21
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/21716034843.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41532.
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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/deploy_preview.sh (1)

117-126: ⚠️ Potential issue | 🟡 Minor

Consider conditional injection for all optional API keys, not just Betterbugs.

Empty values are currently passed unconditionally to Helm for all optional API keys (OPENAI_API_KEY, APPSMITH_CARBON_API_KEY, APPSMITH_BETTERBUGS_API_KEY). While the application code handles empty Betterbugs keys explicitly, applying conditional injection consistently across all optional keys would prevent unnecessary ConfigMap pollution and avoid potential SDK initialization side effects.

Either implement conditional injection for all optional API keys, or confirm the Helm chart and application layers treat empty strings as disabled across the board.

@sebastianiv21
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

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

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

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

@sebastianiv21
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/21725726438.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 41532.
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

🤖 Fix all issues with AI agents
In `@app/client/src/utils/Analytics/betterbugs.ts`:
- Around line 183-195: The hide() method on the BetterBugs utility is marked
async but contains no await or asynchronous work; remove the async modifier from
the hide method declaration to avoid misleading callers and adjust any callers
only if they unnecessarily await BetterBugs.hide(); update references to the
method signature (BetterBugs.hide and this.instance.hide) accordingly so the
method is a plain synchronous function.
🧹 Nitpick comments (1)
app/client/src/utils/Analytics/betterbugs.ts (1)

145-148: Redundant updateMetadata() call.

init() already calls getRuntimeMetadata() and includes it in the initial metadata (line 113). Calling updateMetadata() immediately after is redundant since the runtime state hasn't changed between these synchronous calls.

♻️ Remove redundant call
     // Initialize fresh instance
     await this.init(user);
 
-    this.updateMetadata();
-
     if (this.instance?.openWidget) {

Comment on lines +183 to +195
public static async hide() {
if (!this.instance) {
log.warn("BetterBugs instance not initialized.");

return;
}

if (this.instance?.hide) {
this.instance.hide();
} else {
log.warn("BetterBugs hide() is not available.");
}
}
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 | 🟡 Minor

Method marked async but performs no async operations.

hide() has no await statements, making the async keyword misleading. Callers might incorrectly assume there's an async operation to await.

🔧 Suggested fix
-  public static async hide() {
+  public static hide() {
     if (!this.instance) {
       log.warn("BetterBugs instance not initialized.");
 
       return;
     }
 
-    if (this.instance?.hide) {
+    if (this.instance.hide) {
       this.instance.hide();
     } else {
       log.warn("BetterBugs hide() is not available.");
     }
   }
🤖 Prompt for AI Agents
In `@app/client/src/utils/Analytics/betterbugs.ts` around lines 183 - 195, The
hide() method on the BetterBugs utility is marked async but contains no await or
asynchronous work; remove the async modifier from the hide method declaration to
avoid misleading callers and adjust any callers only if they unnecessarily await
BetterBugs.hide(); update references to the method signature (BetterBugs.hide
and this.instance.hide) accordingly so the method is a plain synchronous
function.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

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

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

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants