Skip to content

Commit

Permalink
ref(solidstart): Overhaul solidstart options and sourcemap uploading (#…
Browse files Browse the repository at this point in the history
…11173)

* ref(solidstart): Overhaul solidstart options and sourcemap uploading

* Update sourcemap section

* Update options structure to reflect the latest changes

* Update platform-includes/getting-started-sourcemaps/javascript.solidstart.mdx

Co-authored-by: vivianyentran <[email protected]>

---------

Co-authored-by: vivianyentran <[email protected]>
  • Loading branch information
andreiborza and vivianyentran authored Sep 5, 2024
1 parent 7b95848 commit 697f68b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The Sentry SDK provides [middleware lifecycle](https://docs.solidjs.com/solid-st
Complete the setup by adding `sentryBeforeResponseMiddleware` to your `src/middleware.ts` file. If you don't have a `src/middleware.ts` file yet, create one:

```typescript {filename:src/middleware.ts}
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart/middleware';
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart';
import { createMiddleware } from '@solidjs/start/middleware';

export default createMiddleware({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
## Add Readable Stack Traces to Errors

To generate and upload source maps of your Solid Start app use our Vite bundler plugin.
To upload source maps, use the `sentrySolidStartVite` plugin from `@sentry/solidstart` and configure an auth token.
Auth tokens can be passed to the plugin explicitly with the `authToken` option. You can use the
`SENTRY_AUTH_TOKEN` environment variable or have an `.env.sentry-build-plugin` file in the working directory when
building your project.

### Install
We recommend you add the auth token to your CI/CD environment as an environment variable.

```bash {tabTitle:npm}
npm install --save-dev @sentry/vite-plugin
```

```bash {tabTitle:yarn}
yarn add --dev @sentry/vite-plugin
```

```bash {tabTitle:pnpm}
pnpm add --save-dev @sentry/vite-plugin
```

### Config

To get readable stack traces in your production builds, set the `SENTRY_AUTH_TOKEN` environment variable in your build environment. You can also add the environment variable to a `.env.sentry-build-plugin` file in the root of your project.
Learn more about configuring the plugin in our
[Sentry Vite Plugin documentation](https://www.npmjs.com/package/@sentry/vite-plugin).

<OrgAuthTokenNote />

Expand All @@ -28,26 +18,26 @@ SENTRY_PROJECT="___PROJECT_SLUG___"
SENTRY_AUTH_TOKEN="___ORG_AUTH_TOKEN___"
```

Finally, add the plugin in `app.config.ts` and enable sourcemaps.
Add the plugin to your `app.config.ts`.


```TypeScript {filename:app.config.ts}
// app.config.ts
import { defineConfig } from '@solidjs/start/config';
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { sentrySolidStartVite } from '@sentry/solidstart';

export default defineConfig({
// rest of your config
// ...

vite: {
build: {
sourcemap: true,
},
plugins: [
sentryVitePlugin({
sentrySolidStartVite({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
],
},
// ...
});
```

0 comments on commit 697f68b

Please sign in to comment.