Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(solidstart): Overhaul solidstart options and sourcemap uploading #11173

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}),
],
},
// ...
});
```
Loading