Skip to content

feat!: Remove getCurrentHub(), Hub, and getCurrentHubShim() #15122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions docs/migration/v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Sentry.init({
```

- The `DEFAULT_USER_INCLUDES` constant has been removed.
- The `getCurrentHub()`, `Hub` and `getCurrentHubShim()` APIs have been removed. They were on compatibility life support since the release of v8 and have now been fully removed from the SDK.

### `@sentry/browser`

Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ export {
getActiveSpan,
getAutoPerformanceIntegrations,
getClient,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getCurrentScope,
getDefaultIntegrations,
getGlobalScope,
Expand Down
3 changes: 0 additions & 3 deletions packages/astro/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export declare const defaultStackParser: StackParser;
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;

// eslint-disable-next-line deprecation/deprecation
export declare const getCurrentHub: typeof clientSdk.getCurrentHub;

export declare const Span: clientSdk.Span;

export default sentryAstro;
2 changes: 0 additions & 2 deletions packages/aws-serverless/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export {
endSession,
withMonitor,
createTransport,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getClient,
isInitialized,
generateInstrumentOnce,
Expand Down
2 changes: 0 additions & 2 deletions packages/browser/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export {
createTransport,
lastEventId,
flush,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getClient,
isInitialized,
getCurrentScope,
Expand Down
28 changes: 2 additions & 26 deletions packages/browser/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import type { Mock } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import * as SentryCore from '@sentry/core';
import { Scope, createTransport } from '@sentry/core';
import { createTransport } from '@sentry/core';
import { resolvedSyncPromise } from '@sentry/core';
import type { Client, Integration } from '@sentry/core';
import type { Integration } from '@sentry/core';

import type { BrowserOptions } from '../src';
import { WINDOW } from '../src';
Expand All @@ -34,30 +34,6 @@ export class MockIntegration implements Integration {
}
}

vi.mock('@sentry/core', async requireActual => {
return {
...((await requireActual()) as any),
getCurrentHub(): {
bindClient(client: Client): boolean;
getClient(): boolean;
getScope(): Scope;
} {
return {
getClient(): boolean {
return false;
},
getScope(): Scope {
return new Scope();
},
bindClient(client: Client): boolean {
client.init!();
return true;
},
};
},
};
});

describe('init', () => {
beforeEach(() => {
vi.clearAllMocks();
Expand Down
2 changes: 0 additions & 2 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export {
endSession,
withMonitor,
createTransport,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
getClient,
isInitialized,
generateInstrumentOnce,
Expand Down
73 changes: 0 additions & 73 deletions packages/core/src/getCurrentHubShim.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ export { trpcMiddleware } from './trpc';
export { captureFeedback } from './feedback';
export type { ReportDialogOptions } from './report-dialog';

// eslint-disable-next-line deprecation/deprecation
export { getCurrentHubShim, getCurrentHub } from './getCurrentHubShim';

// TODO: Make this structure pretty again and don't do "export *"
export * from './utils-hoist/index';
// TODO: Make this structure pretty again and don't do "export *"
Expand Down
Loading
Loading