Skip to content

Commit 50033e8

Browse files
committed
update migration docs with api changes
1 parent 2e12939 commit 50033e8

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

MIGRATION.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,26 @@ However, directly importing from specific files is discouraged.
5656

5757
## Removing the `API` class from `@sentry/core`
5858

59-
The internal `API` class was removed in favor of the `initAPIDetails` function and the `APIDetails` type. More details can be found in the [PR that deprecated this class](https://github.com/getsentry/sentry-javascript/pull/4281). To migrate, see the following example.
59+
The internal `API` class was removed in favor of explicitly accessing client options and the dsn.
6060

6161
```js
6262
// New in v7:
63-
import {
64-
initAPIDetails,
65-
getEnvelopeEndpointWithUrlEncodedAuth,
66-
getStoreEndpointWithUrlEncodedAuth,
67-
} from '@sentry/core';
63+
import { makeDsn } from '@sentry/utils';
6864

69-
const dsn = initAPIDetails(dsn, metadata, tunnel);
65+
const dsn = makeDsn(dsn);
7066
const dsn = api.dsn;
71-
const storeEndpoint = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
72-
const envelopeEndpoint = getStoreEndpointWithUrlEncodedAuth(api.dsn);
67+
68+
const client = getCurrentHub().getClient();
69+
const dsn = client.getDsn();
70+
const clientOptions = client.getOptions();
71+
72+
const envelopeEndpoint = getEnvelopeEndpointWithUrlEncodedAuth(dsn, clientOptions.tunnel);
7373

7474
// Before:
7575
import { API } from '@sentry/core';
7676

7777
const api = new API(dsn, metadata, tunnel);
7878
const dsn = api.getDsn();
79-
const storeEndpoint = api.getStoreEndpointWithUrlEncodedAuth();
8079
const envelopeEndpoint = api.getEnvelopeEndpointWithUrlEncodedAuth();
8180
```
8281

0 commit comments

Comments
 (0)