Skip to main content

Solid

Beta

This page documents the Bugsee JavaScript SDK, which is in beta (0.1.x) and can change between betas.

@bugsee/solid adds Solid-specific error reporting to the browser SDK. It reports errors from Solid's error primitives and names navigations after the matched @solidjs/router route.

Requirements​

  • solid-js 1.6 or newer, and @solidjs/router 0.10 or newer for route names (both optional peer dependencies).
  • An app token. Create a JavaScript application in Bugsee and choose SolidJS as its target; see Create your app.

Install​

Install the adapter. It pulls in @bugsee/bugsee and re-exports it, so launch() comes from the adapter and you do not add @bugsee/bugsee yourself.

npm install @bugsee/solid

Set up​

Launch Bugsee as early as possible, at the top of your entry module. In the browser launch() returns a Promise of the client. Await it only if you need the client right away.

index.tsx
import { launch } from '@bugsee/solid';

launch('<your_app_token>');

Solid hands errors to a callback, so pass Bugsee's reporter to Solid's own error seam:

App.tsx
import { ErrorBoundary } from 'solid-js';
import { solidErrorHandler } from '@bugsee/solid';

const report = solidErrorHandler();

<ErrorBoundary
fallback={(err) => {
report(err);
return <Crashed />;
}}
>
<App />
</ErrorBoundary>;

catchError(() => <App />, solidErrorHandler()) works the same way.

note

These seams catch synchronous render and reactive errors. The SDK's global error capture covers asynchronous and event-handler errors.

Route names (@solidjs/router)​

import { useCurrentMatches } from '@solidjs/router';
import { createEffect } from 'solid-js';
import { setRouteNameFromSolidMatches } from '@bugsee/solid';

const matches = useCurrentMatches();
createEffect(() => setRouteNameFromSolidMatches(matches()));

Component names in minified builds​

The full setup is on Component names.

Install the Babel plugin so clicks and errors are attributed to the component that rendered them, even after minification.

npm install --save-dev @bugsee/babel-plugin-component-annotate
babel.config.js
module.exports = {
plugins: [['@bugsee/babel-plugin-component-annotate']],
};

See Component names for how to add it to your Babel or Vite config.

API​

@bugsee/solid installs @bugsee/bugsee for you and re-exports everything from it, so launch, the client types and the rest of the SDK API come from this one package. You do not install or import @bugsee/bugsee separately.

ExportDescription
solidErrorHandler(options?)Returns a reporter function (error) => void for ErrorBoundary or catchError.
reportSolidError(error, options?)Reports an error you caught yourself.
setRouteNameFromSolidMatches(matches)Names the active navigation after the matched route.

Launch options​

launch(appToken, options) accepts all browser options. The most relevant:

OptionTypeDefaultDescription
captureLogsbooleantrueCapture console output.
captureNetworkbooleantrueCapture network requests.
maxRecordingTimenumber60Seconds of recording to keep.
replayboolean or objecttrueSession replay settings, or false to turn replay off.
captureInteractionsbooleantrueCapture user interactions.

Notes​

  • Source maps. Upload source maps so Solid stacks are readable. See Symbolication.
  • Sensitive content. Session replay masks text and inputs by default. See Privacy.

Verify​

Throw from a component inside the boundary:

function Bomb(): never {
throw new Error('Bugsee test error');
}

Render it. The fallback appears, and the error shows up in the Bugsee dashboard.

Found an issue, typo, or wrong statement on this page? Report it now →