Skip to content

Commit 96c7f72

Browse files
authored
ref(api): Remove lastEventId deprecation warnings (#11951) (#12042)
The `lastEventId` api will be brought back in v8 in the near future.
1 parent 3ae4f45 commit 96c7f72

File tree

19 files changed

+2
-83
lines changed

19 files changed

+2
-83
lines changed

MIGRATION.md

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ If you are using the `Hub` right now, see the following table on how to migrate
256256
| captureException() | `Sentry.captureException()` |
257257
| captureMessage() | `Sentry.captureMessage()` |
258258
| captureEvent() | `Sentry.captureEvent()` |
259-
| lastEventId() | REMOVED - Use event processors or beforeSend instead |
259+
| lastEventId() | `Sentry.lastEventId()` |
260260
| addBreadcrumb() | `Sentry.addBreadcrumb()` |
261261
| setUser() | `Sentry.setUser()` |
262262
| setTags() | `Sentry.setTags()` |
@@ -381,36 +381,6 @@ app.get('/your-route', req => {
381381
});
382382
```
383383

384-
## Deprecate `Sentry.lastEventId()` and `hub.lastEventId()`
385-
386-
`Sentry.lastEventId()` sometimes causes race conditions, so we are deprecating it in favour of the `beforeSend`
387-
callback.
388-
389-
```js
390-
// Before
391-
392-
Sentry.init({
393-
beforeSend(event, hint) {
394-
const lastCapturedEventId = Sentry.lastEventId();
395-
396-
// Do something with `lastCapturedEventId` here
397-
398-
return event;
399-
},
400-
});
401-
402-
// After
403-
Sentry.init({
404-
beforeSend(event, hint) {
405-
const lastCapturedEventId = event.event_id;
406-
407-
// Do something with `lastCapturedEventId` here
408-
409-
return event;
410-
},
411-
});
412-
```
413-
414384
## Deprecated fields on `Span` and `Transaction`
415385

416386
In v8, the Span class is heavily reworked. The following properties & methods are thus deprecated:
@@ -478,25 +448,6 @@ Instead, import this directly from `@sentry/utils`.
478448
Generally, in most cases you should probably use `continueTrace` instead, which abstracts this away from you and handles
479449
scope propagation for you.
480450

481-
## Deprecate `lastEventId()`
482-
483-
Instead, if you need the ID of a recently captured event, we recommend using `beforeSend` instead:
484-
485-
```ts
486-
import * as Sentry from '@sentry/browser';
487-
488-
Sentry.init({
489-
dsn: '__DSN__',
490-
beforeSend(event, hint) {
491-
const lastCapturedEventId = event.event_id;
492-
493-
// Do something with `lastCapturedEventId` here
494-
495-
return event;
496-
},
497-
});
498-
```
499-
500451
## Deprecate `timestampWithMs` export - #7878
501452

502453
The `timestampWithMs` util is deprecated in favor of using `timestampInSeconds`.
@@ -621,7 +572,7 @@ This is no longer used.
621572

622573
## Deprecate @sentry/hub (since 7.15.0) - #5823
623574

624-
This release deprecates `@sentry/hub` and all of it's exports. All of the `@sentry/hub` exports have moved to
575+
This release deprecates `@sentry/hub` and all of its exports. All of the `@sentry/hub` exports have moved to
625576
`@sentry/core`. `@sentry/hub` will be removed in the next major release.
626577

627578
# Upgrading Sentry Replay (beta, 7.24.0)

packages/astro/src/index.server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export {
6161
defaultIntegrations,
6262
getDefaultIntegrations,
6363
defaultStackParser,
64-
// eslint-disable-next-line deprecation/deprecation
6564
lastEventId,
6665
flush,
6766
close,

packages/astro/src/index.types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ export declare const defaultStackParser: StackParser;
2626

2727
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2828
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
29-
30-
/**
31-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
32-
*/
3329
export declare function lastEventId(): string | undefined;
3430

3531
export default sentryAstro;

packages/browser/src/exports.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export {
4444
getCurrentScope,
4545
// eslint-disable-next-line deprecation/deprecation
4646
Hub,
47-
// eslint-disable-next-line deprecation/deprecation
4847
lastEventId,
4948
// eslint-disable-next-line deprecation/deprecation
5049
// eslint-disable-next-line deprecation/deprecation

packages/browser/src/sdk.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ export const showReportDialog: ShowReportDialogFunction = (
198198
};
199199
}
200200

201-
// TODO(v8): Remove this entire if statement. `eventId` will be a required option.
202-
// eslint-disable-next-line deprecation/deprecation
203201
if (!options.eventId) {
204202
// eslint-disable-next-line deprecation/deprecation
205203
options.eventId = hub.lastEventId();

packages/bun/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export {
5151
getIsolationScope,
5252
// eslint-disable-next-line deprecation/deprecation
5353
Hub,
54-
// eslint-disable-next-line deprecation/deprecation
5554
lastEventId,
5655
// eslint-disable-next-line deprecation/deprecation
5756
makeMain,

packages/core/src/exports.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ export async function close(timeout?: number): Promise<boolean> {
387387
* This is the getter for lastEventId.
388388
*
389389
* @returns The last event id of a captured event.
390-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
391390
*/
392391
export function lastEventId(): string | undefined {
393392
// eslint-disable-next-line deprecation/deprecation

packages/core/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export {
1919
// eslint-disable-next-line deprecation/deprecation
2020
configureScope,
2121
flush,
22-
// eslint-disable-next-line deprecation/deprecation
2322
lastEventId,
2423
// eslint-disable-next-line deprecation/deprecation
2524
startTransaction,

packages/deno/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export {
5050
getIsolationScope,
5151
// eslint-disable-next-line deprecation/deprecation
5252
Hub,
53-
// eslint-disable-next-line deprecation/deprecation
5453
lastEventId,
5554
// eslint-disable-next-line deprecation/deprecation
5655
makeMain,

packages/node-experimental/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export {
3636
captureMessage,
3737
addGlobalEventProcessor,
3838
addEventProcessor,
39-
// eslint-disable-next-line deprecation/deprecation
4039
lastEventId,
4140
setContext,
4241
setExtra,

0 commit comments

Comments
 (0)