# Move from Sentry

Point an app that sends to Sentry at Error Tracking by changing its DSN and its auth token, and see what stays behind.

The Sentry SDKs need no other change than the DSN. For source maps, `sentry-cli` and
`withSentryConfig` need only a new `SENTRY_AUTH_TOKEN`.

## Prerequisites

- A project (see [Create a project](create-a-project.md)), which needs `errors:CreateProject`.
- For source maps, a token (see [Upload source maps](upload-source-maps.md)), which needs
  `iam:CreateAccessKey` and `errors:UploadSourceMaps`.

## Switch the app

1. Replace the DSN in `Sentry.init({ dsn })`, or in `SENTRY_DSN`, with the project's DSN.
2. For source maps, put a token from the project's **Setup** tab into `SENTRY_AUTH_TOKEN`. The token
   carries the Error Tracking URL and your organization, so `sentry-cli` and `withSentryConfig`
   send to Deutsche Cloud without `SENTRY_URL`. Your `org` and `project` settings may stay as they are.
3. (Optional) In `withSentryConfig`, set `sentryUrl` to the **Sentry URL (sentry-cli)** the
   **Setup** tab shows. Uploads work without it; with it, the bundler plugin also stops sending
   its own telemetry to sentry.io.

An app deployed on Deutsche Cloud can skip all three: connect it instead (see
[Connect an app](connect-an-app.md)).

A tunnel route (an app that forwards browser envelopes through its own server, including
`withSentryConfig({ tunnelRoute })`) keeps working: the DSN has no path, so the envelope endpoint
derived from it, `https://errors.<domain>/api/<project number>/envelope/`, is right. The ingest also
reads the DSN from the envelope's own header, which is how a tunnel forwards it.

## Send to both while you compare

To compare before switching, send every browser envelope to a second client as well:

```ts
import * as Sentry from '@sentry/nextjs';

Sentry.init({ dsn: process.env.SENTRY_DSN }); // your Sentry project, unchanged
const second = new Sentry.BrowserClient({
  dsn: process.env.NEXT_PUBLIC_ERRORS_DSN, // this project's DSN
  transport: Sentry.makeFetchTransport,
  stackParser: Sentry.defaultStackParser,
  integrations: [],
});
Sentry.getClient()?.on('beforeEnvelope', (envelope) => void second.getTransport()?.send(envelope));
```

## What does not come over

- **History.** Existing issues, their resolved or ignored state, assignees and comments stay in
  Sentry. Issues start fresh here. Grouping follows Sentry's rules closely but not exactly, so one
  Sentry issue may become two here or the other way round (see
  [Issues and grouping](issues-and-grouping.md)).
- **Inbound filters and server-side data scrubbing** of error events: scrub in `beforeSend` and keep
  `sendDefaultPii: false`.
- **Data of kinds not supported yet**, such as Session Replay, cron check-ins and logs (see
  [Not supported](not-supported.md)). The ingest answers those items with a one-hour rate limit for
  their category, so the SDK stops spending CPU and bandwidth on them.

## Related

- [How events are received](how-events-are-received.md)
- [Use the Sentry API](use-the-sentry-api.md)
