Skip to content

feat(core)!: Remove BaseClient #17071

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 1 commit into from
Jul 18, 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
2 changes: 1 addition & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Updates and fixes for version 9 will be published as `SentryNodeServerlessSDKv9`

### `@sentry/core` / All SDKs

- TODO: fill in removed APIs
- `BaseClient` was removed, use `Client` as a direct replacement.

## No Version Support Timeline

Expand Down
12 changes: 0 additions & 12 deletions packages/core/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1246,18 +1246,6 @@ export abstract class Client<O extends ClientOptions = ClientOptions> {
): PromiseLike<Event>;
}

/**
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
*/
// TODO(v10): Remove
export type BaseClient = Client;

/**
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
*/
// TODO(v10): Remove
export const BaseClient = Client;

/**
* Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
*/
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ export { Scope } from './scope';
export type { CaptureContext, ScopeContext, ScopeData } from './scope';
export { notifyEventProcessors } from './eventProcessors';
export { getEnvelopeEndpointWithUrlEncodedAuth, getReportDialogEndpoint } from './api';
export {
Client,
// eslint-disable-next-line deprecation/deprecation
BaseClient,
} from './client';
export { Client } from './client';
export { ServerRuntimeClient } from './server-runtime-client';
export { initAndBind, setCurrentClient } from './sdk';
export { createTransport } from './transports/base';
Expand Down
35 changes: 13 additions & 22 deletions packages/core/test/lib/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
SyncPromise,
withMonitor,
} from '../../src';
import type { BaseClient, Client } from '../../src/client';
import * as integrationModule from '../../src/integration';
import type { Envelope } from '../../src/types-hoist/envelope';
import type { ErrorEvent, Event, TransactionEvent } from '../../src/types-hoist/event';
Expand Down Expand Up @@ -2107,30 +2106,22 @@ describe('Client', () => {
describe('hooks', () => {
const options = getDefaultTestClientOptions({ dsn: PUBLIC_DSN });

// Make sure types work for both Client & BaseClient
const scenarios = [
// eslint-disable-next-line deprecation/deprecation
['BaseClient', new TestClient(options) as BaseClient],
['Client', new TestClient(options) as Client],
] as const;

describe.each(scenarios)('with client %s', (_, client) => {
it('should call a beforeEnvelope hook', () => {
expect.assertions(1);

const mockEnvelope = [
{
event_id: '12345',
},
{},
] as Envelope;
it('should call a beforeEnvelope hook', () => {
const client = new TestClient(options);
expect.assertions(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know 100% this is a Andrei PR when I see this :D

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it already existed 😎


client.on('beforeEnvelope', envelope => {
expect(envelope).toEqual(mockEnvelope);
});
const mockEnvelope = [
{
event_id: '12345',
},
{},
] as Envelope;

client.emit('beforeEnvelope', mockEnvelope);
client.on('beforeEnvelope', envelope => {
expect(envelope).toEqual(mockEnvelope);
});

client.emit('beforeEnvelope', mockEnvelope);
});
});

Expand Down
Loading