Troubleshooting
What to check when data is not arriving, the built-in diagnostics helpers, and the init behaviors that most often surprise people.
Nothing is arriving#
Work down this list:
Check the console.
init()never throws — on a bad config it logs[scalebun] init failed: …and leaves the SDK inert. That warning is your first clue.Confirm both required fields.
clientKeyandapiBaseUrlare mandatory; a missing one leaves the SDK silently inert.Call
init()on the client. It must run in the browser, not during SSR, and as early as possible.Check consent. With
requireConsent: true, nothing is captured untilsetConsent(true)is called.Check CSP. If the ingestion API is blocked by
connect-src, requests never leave the browser. See Privacy & consent.
Diagnostics#
The SDK exposes live counters and a manual flush you can call from the console:
ScaleBun.sessionId; // the current session id — quote this in a support ticketScaleBun.egressStats(); // { pending, dropped } across both lanesScaleBun.errorStats(); // captured, dropped-by-reason, by type, breadcrumb countScaleBun.networkStats(); // captured, by protocol, by failure, dropped, bodiesScaleBun.perfStats(); // transactions, dropped, resources, jank, sample rateScaleBun.analyticsStats(); // pending, dropped, sampledOut, flushes, sampleRateScaleBun.replay.stats(); // null when this session isn't being recordedScaleBun.watchdog.stats(); // null unless the watchdog is enabled
await ScaleBun.flush(); // force-send both lanes nowawait ScaleBun.close(); // flush and shut downpending climbing while dropped stays at zero means egress is blocked, not
that capture is broken — check the network tab and connect-src. dropped
climbing means the queue is overflowing, which is a volume or connectivity
problem rather than a configuration one.
A feature does nothing and reports no error#
Most "it silently does nothing" reports are one of these.
| Symptom | Cause |
|---|---|
| A controller's methods do nothing, forever | It was read before init() resolved. Accessors return a no-op object rather than throwing. await ScaleBun.whenReady() first. |
| The inbox is always empty | features.inbox is off by default, and the disabled controller is a no-op. |
| In-app messages never render | Same, for features.inapp2 — or an inline campaign with no registered slot, which falls back to a modal. |
Push does nothing after enablePush() | /scalebun-push-sw.js is not served from your origin, or the call was not made from a user gesture. |
profiler.start() returns false | The document is not served with Document-Policy: js-profiling. |
| No replay for a session | It was not sampled. ScaleBun.replay.stats() returns null — that is the answer, not a bug. |
| A segment-targeted campaign never shows | The visitor is still anonymous. Call identify() — segments cannot resolve without a user. |
| An inline message renders nowhere | The slot element unmounted without being unregistered, so it points at a detached node. |
Things that surprise people#
Next#
Install & initialize — required fields and delivery.
Privacy & consent — consent and CSP.