This SDK is considered
This package is a wrapper around @sentry/node for the server and @sentry/solid for the client side, with added
functionality related to Solid Start.
If the setup through the wizard doesn't work for you, you can also set up the SDK manually.
Install the Sentry Solid Start SDK:
# Using npm
npm install @sentry/solidstart
# Using yarn
yarn add @sentry/solidstartInitialize the SDK in entry-client.jsx
import * as Sentry from '@sentry/solidstart';
import { mount, StartClient } from '@solidjs/start/client';
Sentry.init({
dsn: '__PUBLIC_DSN__',
tracesSampleRate: 1.0, // Capture 100% of the transactions
});
mount(() => <StartClient />, document.getElementById('app'));Create an instrument file named instrument.server.mjs and add your initialization code for the server-side SDK.
import * as Sentry from '@sentry/solidstart';
Sentry.init({
dsn: 'https://0e67f7dd5326d51506e92d7f1eff887a@o447951.ingest.us.sentry.io/4507459091824640',
tracesSampleRate: 1.0, // Capture 100% of the transactions
});Then run your app
NODE_OPTIONS='--import=./instrument.server.mjs' yarn start
# or
NODE_OPTIONS='--require=./instrument.server.js' yarn startThe Solid Router instrumentation uses the Solid Router library to create navigation spans to ensure you collect meaningful performance data about the health of your page loads and associated requests.
Wrap Router, MemoryRouter or HashRouter from @solidjs/router using withSentryRouterRouting. This creates a
higher order component, which will enable Sentry to reach your router context.
import { withSentryRouterRouting } from '@sentry/solidstart/solidrouter';
import { Route, Router } from '@solidjs/router';
const SentryRouter = Sentry.withSentryRouterRouting(Router);
render(
() => (
<SentryRouter>
<Route path="/" component={App} />
...
</SentryRouter>
),
document.getElementById('root'),
);To automatically capture exceptions from inside a component tree and render a fallback component, wrap the native Solid
JS ErrorBoundary component with Sentry.withSentryErrorBoundary.
import * as Sentry from '@sentry/solidstart';
import { ErrorBoundary } from 'solid-js';
Sentry.init({
dsn: '__PUBLIC_DSN__',
tracesSampleRate: 1.0, // Capture 100% of the transactions
});
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);
render(
() => (
<SentryErrorBoundary fallback={err => <div>Error: {err.message}</div>}>
<ProblematicComponent />
</SentryErrorBoundary>
),
document.getElementById('root'),
);