---
title: "Solid 2 (Alpha)"
description: "Learn how to set up Sentry in a Solid 2 app and capture your first errors."
url: https://docs.sentry.io/platforms/javascript/guides/solid/solid-2/
---

# Solid 2 (Alpha)

##### Alpha

Support for Solid 2 is in alpha. The API can change in any release. It lives under the `@sentry/solid/solid2` subpaths and is separate from the Solid 1 SDK documented on the other pages of this guide. Please [report issues](https://github.com/getsentry/sentry-javascript/issues/new/choose) you run into.

This guide covers Solid 2 apps built with `@solidjs/vite-plugin`. You import the SDK from `@sentry/solid/solid2` in the browser and on the server. The SDK picks the right build for each one.

## [Install](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#install)

Install the SDK. It requires `solid-js` 2.0.0 or later, and `@solidjs/web` and `@solidjs/router` 2.0.0 or later if you use the router.

```bash
npm install @sentry/solid
```

*Other available variations of the above snippet: yarn, pnpm*

## [Configure the Browser](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#configure-the-browser)

### [Initialize the SDK](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#initialize-the-sdk)

Call `init()` in a setup file, and point `start.clientSetup` in your Vite config to it.

Errors caught by an `<Errored>` boundary are reported, and so are errors that no boundary catches. If you pass `onError` to `render()` or `hydrate()`, it replaces Sentry's handler for that root, and errors caught by boundaries under it are not reported.

```ts
import * as Sentry from "@sentry/solid/solid2";
import { solidRouterBrowserTracingIntegration } from "@sentry/solid/solid2/solidrouter";

Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  integrations: [solidRouterBrowserTracingIntegration()],
  // Adjust this value in production, or use tracesSampler for greater control.
  tracesSampleRate: 1.0,
});
```

### [Wrap the Router](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#wrap-the-router)

If you use `@solidjs/router`, add `solidRouterBrowserTracingIntegration()` to `integrations` as shown above, and wrap your router with `withSentryRouterRouting`. Page loads and navigations then get spans named after the route, for example `/user/:id`.

```tsx
import { withSentryRouterRouting } from "@sentry/solid/solid2/solidrouter";
import { createRouter } from "@solidjs/router";

const Router = withSentryRouterRouting(
  createRouter({
    routes: [
      { path: "/", component: Home },
      { path: "/user/:id", component: User },
    ],
  }),
);

export default function App() {
  return <Router />;
}
```

## [Configure the Server](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#configure-the-server)

Call `init()` in a setup file, and point `start.serverSetup` to it. Use the same import path as in the browser.

```ts
import * as Sentry from "@sentry/solid/solid2";

Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  // Adjust this value in production, or use tracesSampler for greater control.
  tracesSampleRate: 1.0,
});
```

Enable the Node server, server rendering, and server functions in your Vite config, and point the setup options to both files:

```ts
import solid from "@solidjs/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    solid({
      start: {
        nodeServer: true,
        serverSetup: "./src/instrument.server.ts",
        clientSetup: "./src/instrument.client.ts",
      },
      ssr: true,
      serverFunctions: true,
    }),
  ],
});
```

Errors thrown during server rendering and in server functions are reported. If a boundary rendered a fallback for an error, the error is marked as handled.

With the router wrapped, request spans are named after the route, for example `GET /user/:id`. The browser page load continues the server's trace, so you see the request and the page load in one trace.

## [Upload Source Maps](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#upload-source-maps)

Your app is built with Vite, so follow the [Vite source maps guide](https://docs.sentry.io/platforms/javascript/guides/solid/sourcemaps/uploading/vite.md) to get readable stack traces.

## [Verify](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#verify)

Start the app, and throw an error from a component and from a server function. Both should show up as issues in your project.

## [Not Supported Yet](https://docs.sentry.io/platforms/javascript/guides/solid/solid-2.md#not-supported-yet)

* TanStack Router for Solid 2.
* SolidStart. It's discontinued for Solid 2, so the [SolidStart guide](https://docs.sentry.io/platforms/javascript/guides/solidstart.md) covers Solid 1 only.
