Skip to content

Commit 9f0ac34

Browse files
authored
ref: Remove lastEventId (#10585)
After the deprecation in v7 we now remove `lastEventId`.
1 parent ee9a9d6 commit 9f0ac34

File tree

23 files changed

+3
-113
lines changed

23 files changed

+3
-113
lines changed

packages/astro/src/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export {
5858
defaultIntegrations,
5959
getDefaultIntegrations,
6060
defaultStackParser,
61-
// eslint-disable-next-line deprecation/deprecation
62-
lastEventId,
6361
flush,
6462
close,
6563
getSentryRelease,

packages/astro/src/index.types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,4 @@ export declare const defaultStackParser: StackParser;
2626
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2727
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
2828

29-
/**
30-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
31-
*/
32-
export declare function lastEventId(): string | undefined;
33-
3429
export default sentryAstro;

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export {
4242
getCurrentScope,
4343
Hub,
4444
// eslint-disable-next-line deprecation/deprecation
45-
lastEventId,
46-
// eslint-disable-next-line deprecation/deprecation
4745
// eslint-disable-next-line deprecation/deprecation
4846
makeMain,
4947
setCurrentClient,

packages/browser/src/sdk.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +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
203-
if (!options.eventId) {
204-
// eslint-disable-next-line deprecation/deprecation
205-
options.eventId = hub.lastEventId();
206-
}
207-
208201
const script = WINDOW.document.createElement('script');
209202
script.async = true;
210203
script.crossOrigin = 'anonymous';

packages/bun/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ export {
4949
getIsolationScope,
5050
Hub,
5151
// eslint-disable-next-line deprecation/deprecation
52-
lastEventId,
53-
// eslint-disable-next-line deprecation/deprecation
5452
makeMain,
5553
setCurrentClient,
5654
runWithAsyncContext,

packages/core/src/exports.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,6 @@ export async function close(timeout?: number): Promise<boolean> {
370370
return Promise.resolve(false);
371371
}
372372

373-
/**
374-
* This is the getter for lastEventId.
375-
*
376-
* @returns The last event id of a captured event.
377-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
378-
*/
379-
export function lastEventId(): string | undefined {
380-
// eslint-disable-next-line deprecation/deprecation
381-
return getCurrentHub().lastEventId();
382-
}
383-
384373
/**
385374
* Get the currently active client.
386375
*/

packages/core/src/hub.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,6 @@ export class Hub implements HubInterface {
121121
/** Is a {@link Layer}[] containing the client and scope */
122122
private readonly _stack: Layer[];
123123

124-
/** Contains the last event id of a captured event. */
125-
private _lastEventId?: string;
126-
127124
private _isolationScope: Scope;
128125

129126
/**
@@ -354,7 +351,7 @@ export class Hub implements HubInterface {
354351
* @deprecated Use `Sentry.captureException()` instead.
355352
*/
356353
public captureException(exception: unknown, hint?: EventHint): string {
357-
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
354+
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
358355
const syntheticException = new Error('Sentry syntheticException');
359356
// eslint-disable-next-line deprecation/deprecation
360357
this.getScope().captureException(exception, {
@@ -373,7 +370,7 @@ export class Hub implements HubInterface {
373370
* @deprecated Use `Sentry.captureMessage()` instead.
374371
*/
375372
public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {
376-
const eventId = (this._lastEventId = hint && hint.event_id ? hint.event_id : uuid4());
373+
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
377374
const syntheticException = new Error(message);
378375
// eslint-disable-next-line deprecation/deprecation
379376
this.getScope().captureMessage(message, level, {
@@ -393,23 +390,11 @@ export class Hub implements HubInterface {
393390
*/
394391
public captureEvent(event: Event, hint?: EventHint): string {
395392
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
396-
if (!event.type) {
397-
this._lastEventId = eventId;
398-
}
399393
// eslint-disable-next-line deprecation/deprecation
400394
this.getScope().captureEvent(event, { ...hint, event_id: eventId });
401395
return eventId;
402396
}
403397

404-
/**
405-
* @inheritDoc
406-
*
407-
* @deprecated This will be removed in v8.
408-
*/
409-
public lastEventId(): string | undefined {
410-
return this._lastEventId;
411-
}
412-
413398
/**
414399
* @inheritDoc
415400
*

packages/core/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export {
2020
configureScope,
2121
flush,
2222
// eslint-disable-next-line deprecation/deprecation
23-
lastEventId,
24-
// eslint-disable-next-line deprecation/deprecation
2523
startTransaction,
2624
setContext,
2725
setExtra,

packages/deno/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export {
4848
getIsolationScope,
4949
Hub,
5050
// eslint-disable-next-line deprecation/deprecation
51-
lastEventId,
52-
// eslint-disable-next-line deprecation/deprecation
5351
makeMain,
5452
setCurrentClient,
5553
runWithAsyncContext,

packages/node-experimental/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export {
3636
captureMessage,
3737
addGlobalEventProcessor,
3838
addEventProcessor,
39-
// eslint-disable-next-line deprecation/deprecation
40-
lastEventId,
4139
setContext,
4240
setExtra,
4341
setExtras,

packages/node-experimental/src/sdk/api.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,6 @@ export function withIsolationScope<T>(callback: (isolationScope: Scope) => T): T
9696
});
9797
}
9898

99-
/**
100-
* Get the ID of the last sent error event.
101-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
102-
*/
103-
export function lastEventId(): string | undefined {
104-
// eslint-disable-next-line deprecation/deprecation
105-
return getCurrentScope().lastEventId();
106-
}
107-
10899
/**
109100
* Configure the current scope.
110101
* @deprecated Use `getCurrentScope()` instead.

packages/node-experimental/src/sdk/hub.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
configureScope,
1717
getClient,
1818
getCurrentScope,
19-
lastEventId,
2019
setContext,
2120
setExtra,
2221
setExtras,
@@ -71,7 +70,6 @@ export function getCurrentHub(): Hub {
7170
return getCurrentScope().captureMessage(message, level, hint);
7271
},
7372
captureEvent,
74-
lastEventId,
7573
addBreadcrumb,
7674
setUser,
7775
setTags,

packages/node-experimental/src/sdk/scope.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export function isInitialized(): boolean {
7474
export class Scope extends OpenTelemetryScope implements ScopeInterface {
7575
protected _client: Client | undefined;
7676

77-
protected _lastEventId: string | undefined;
78-
7977
/**
8078
* @inheritDoc
8179
*/
@@ -131,8 +129,6 @@ export class Scope extends OpenTelemetryScope implements ScopeInterface {
131129
this,
132130
);
133131

134-
this._lastEventId = eventId;
135-
136132
return eventId;
137133
}
138134

@@ -153,28 +149,18 @@ export class Scope extends OpenTelemetryScope implements ScopeInterface {
153149
this,
154150
);
155151

156-
this._lastEventId = eventId;
157-
158152
return eventId;
159153
}
160154

161155
/** Capture a message for this scope. */
162156
public captureEvent(event: Event, hint?: EventHint): string {
163157
const eventId = hint && hint.event_id ? hint.event_id : uuid4();
164-
if (!event.type) {
165-
this._lastEventId = eventId;
166-
}
167158

168159
getClient().captureEvent(event, { ...hint, event_id: eventId }, this);
169160

170161
return eventId;
171162
}
172163

173-
/** Get the ID of the last sent error event. */
174-
public lastEventId(): string | undefined {
175-
return this._lastEventId;
176-
}
177-
178164
/**
179165
* @inheritDoc
180166
*/

packages/node-experimental/src/sdk/types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export interface ScopeData {
3030
export interface Scope extends BaseScope {
3131
// @ts-expect-error typeof this is what we want here
3232
clone(scope?: Scope): typeof this;
33-
/**
34-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
35-
*/
36-
lastEventId(): string | undefined;
3733
getScopeData(): ScopeData;
3834
}
3935

packages/node/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export {
4848
getIsolationScope,
4949
Hub,
5050
// eslint-disable-next-line deprecation/deprecation
51-
lastEventId,
52-
// eslint-disable-next-line deprecation/deprecation
5351
makeMain,
5452
setCurrentClient,
5553
runWithAsyncContext,

packages/react/src/errorboundary.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
111111
if (client && client.on && props.showDialog) {
112112
this._openFallbackReportDialog = false;
113113
client.on('afterSendEvent', event => {
114-
if (!event.type && event.event_id === this._lastEventId) {
115-
// eslint-disable-next-line deprecation/deprecation
114+
if (!event.type && this._lastEventId && event.event_id === this._lastEventId) {
116115
showReportDialog({ ...props.dialogOptions, eventId: this._lastEventId });
117116
}
118117
});

packages/remix/src/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ export {
6262
defaultIntegrations,
6363
getDefaultIntegrations,
6464
defaultStackParser,
65-
// eslint-disable-next-line deprecation/deprecation
66-
lastEventId,
6765
flush,
6866
close,
6967
getSentryRelease,

packages/remix/src/index.types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,3 @@ declare const runtime: 'client' | 'server';
2929

3030
export const close = runtime === 'client' ? clientSdk.close : serverSdk.close;
3131
export const flush = runtime === 'client' ? clientSdk.flush : serverSdk.flush;
32-
33-
/**
34-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
35-
*/
36-
// eslint-disable-next-line deprecation/deprecation
37-
export const lastEventId = runtime === 'client' ? clientSdk.lastEventId : serverSdk.lastEventId;

packages/serverless/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ export {
6363
flush,
6464
getSentryRelease,
6565
init,
66-
// eslint-disable-next-line deprecation/deprecation
67-
lastEventId,
6866
DEFAULT_USER_INCLUDES,
6967
addRequestDataToEvent,
7068
extractRequestData,

packages/sveltekit/src/index.types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,3 @@ export declare const defaultStackParser: StackParser;
4848

4949
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
5050
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
51-
52-
/**
53-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
54-
*/
55-
export declare function lastEventId(): string | undefined;

packages/sveltekit/src/server/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ export {
5656
defaultIntegrations,
5757
getDefaultIntegrations,
5858
defaultStackParser,
59-
// eslint-disable-next-line deprecation/deprecation
60-
lastEventId,
6159
flush,
6260
close,
6361
getSentryRelease,

packages/types/src/hub.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,6 @@ export interface Hub {
128128
*/
129129
captureEvent(event: Event, hint?: EventHint): string;
130130

131-
/**
132-
* This is the getter for lastEventId.
133-
*
134-
* @returns The last event id of a captured event.
135-
*
136-
* @deprecated This will be removed in v8.
137-
*/
138-
lastEventId(): string | undefined;
139-
140131
/**
141132
* Records a new breadcrumb which will be attached to future events.
142133
*

packages/vercel-edge/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ export {
4848
getIsolationScope,
4949
Hub,
5050
// eslint-disable-next-line deprecation/deprecation
51-
lastEventId,
52-
// eslint-disable-next-line deprecation/deprecation
5351
makeMain,
5452
setCurrentClient,
5553
runWithAsyncContext,

0 commit comments

Comments
 (0)