Skip to content

Commit 569f2e2

Browse files
committed
update migration docs with api changes
1 parent dc8db00 commit 569f2e2

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

MIGRATION.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,26 @@ However, directly importing from specific files is discouraged.
7878

7979
## Removing the `API` class from `@sentry/core`
8080

81-
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.
81+
The internal `API` class was removed in favor of explicitly accessing client options and the dsn.
8282

8383
```js
8484
// New in v7:
85-
import {
86-
initAPIDetails,
87-
getEnvelopeEndpointWithUrlEncodedAuth,
88-
getStoreEndpointWithUrlEncodedAuth,
89-
} from '@sentry/core';
85+
import { makeDsn } from '@sentry/utils';
9086

91-
const dsn = initAPIDetails(dsn, metadata, tunnel);
87+
const dsn = makeDsn(dsn);
9288
const dsn = api.dsn;
93-
const storeEndpoint = getEnvelopeEndpointWithUrlEncodedAuth(api.dsn, api.tunnel);
94-
const envelopeEndpoint = getStoreEndpointWithUrlEncodedAuth(api.dsn);
89+
90+
const client = getCurrentHub().getClient();
91+
const dsn = client.getDsn();
92+
const clientOptions = client.getOptions();
93+
94+
const envelopeEndpoint = getEnvelopeEndpointWithUrlEncodedAuth(dsn, clientOptions.tunnel);
9595

9696
// Before:
9797
import { API } from '@sentry/core';
9898

9999
const api = new API(dsn, metadata, tunnel);
100100
const dsn = api.getDsn();
101-
const storeEndpoint = api.getStoreEndpointWithUrlEncodedAuth();
102101
const envelopeEndpoint = api.getEnvelopeEndpointWithUrlEncodedAuth();
103102
```
104103

0 commit comments

Comments
 (0)