Skip to content

docs(sveltekit): Add more source maps upload documentation #7844

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

Merged
merged 2 commits into from
Apr 13, 2023
Merged
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
87 changes: 83 additions & 4 deletions packages/sveltekit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,94 @@ The Sentry SvelteKit SDK mostly relies on [SvelteKit Hooks](https://kit.svelte.d

This adds the [Sentry Vite Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/vite-plugin) to your Vite config to automatically upload source maps to Sentry.

## Uploading Source Maps

After completing the [Vite Setup](#5-vite-setup), the SDK will automatically upload source maps to Sentry, when you
build your project. However, you still need to specify your Sentry auth token as well as your org and project slugs. You
can either set them as env variables (for example in a `.env` file):

- `SENTRY_ORG` your Sentry org slug
- `SENTRY_PROJECT` your Sentry project slug
- `SENTRY_AUTH_TOKEN` your Sentry auth token

Or you can pass them in whatever form you prefer to `sentrySvelteKit`:

```js
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
import { sentrySvelteKit } from '@sentry/sveltekit';

export default {
plugins: [
sentrySvelteKit({
sourceMapsUploadOptions: {
org: 'my-org-slug',
project: 'my-project-slug',
authToken: process.env.SENTRY_AUTH_TOKEN,
},
}),
sveltekit(),
],
// ... rest of your Vite config
};
```

### Configuring Source maps upload

Under `sourceMapsUploadOptions`, you can also specify all additional options supported by the
[Sentry Vite Plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/packages/vite-plugin/README.md#configuration).
This might be useful if you're using adapters other than the Node adapter or have a more customized build setup.

```js
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
import { sentrySvelteKit } from '@sentry/sveltekit';

export default {
plugins: [
sentrySvelteKit({
sourceMapsUploadOptions: {
org: 'my-org-slug',
project: 'my-project-slug',
authToken: 'process.env.SENTRY_AUTH_TOKEN',
include: ['dist'],
cleanArtifacts: true,
setCommits: {
auto: true,
},
},
}),
sveltekit(),
],
// ... rest of your Vite config
};
```

### Disabeling automatic source map upload

If you don't want to upload source maps automatically, you can disable it as follows:

```js
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
import { sentrySvelteKit } from '@sentry/sveltekit';

export default {
plugins: [
sentrySvelteKit({
autoUploadSourceMaps: false,
}),
sveltekit(),
],
// ... rest of your Vite config
};
```

## Known Limitations

This SDK is still under active development and several features are missing.
Take a look at our [SvelteKit SDK Development Roadmap](https://github.com/getsentry/sentry-javascript/issues/6692) to follow the progress:

- **Source Maps** upload is not yet working correctly.
We already investigated [some options](https://github.com/getsentry/sentry-javascript/discussions/5838#discussioncomment-4696985) but uploading source maps doesn't work automtatically out of the box yet.
This will be addressed next, as we release the next alpha builds.

- **Adapters** other than `@sveltejs/adapter-node` are currently not supported.
We haven't yet tested other platforms like Vercel.
This is on our roadmap but it will come at a later time.
Expand Down