Skip to content

Commit 8b8480c

Browse files
committed
fixes for vercel ai
1 parent 503482a commit 8b8480c

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

packages/core/src/integration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ export function defineIntegration<Fn extends IntegrationFn>(
195195
* });
196196
* ```
197197
*/
198-
export function extendIntegration<Base extends Integration, Extended extends Partial<Integration>>(
199-
integration: Base,
200-
extendedIntegration: Extended,
201-
): Omit<Base, keyof Extended> & Extended {
198+
export function extendIntegration<
199+
Base extends Integration,
200+
Extended extends Record<string, unknown> & Partial<Integration>,
201+
>(integration: Base, extendedIntegration: Extended): Omit<Base, keyof Extended> & Extended {
202202
// The extension overrides the base for any shared key (object spread + the wrapping below), so the
203203
// result type drops the overridden base keys rather than intersecting them — `Base & Extended` would
204204
// wrongly intersect shared keys (e.g. a re-typed property collapses to `never`).

packages/node/src/integrations/tracing/vercelai/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Client, IntegrationFn } from '@sentry/core';
2-
import { addVercelAiProcessors, defineIntegration } from '@sentry/core';
2+
import { addVercelAiProcessors, defineIntegration, extendIntegration } from '@sentry/core';
33
import { generateInstrumentOnce, type modulesIntegration } from '@sentry/node-core';
44
import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils';
55
import { INTEGRATION_NAME } from './constants';
@@ -22,12 +22,10 @@ const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
2222

2323
const parentIntegration = serverUtilsVercelAiIntegration(options);
2424

25-
return {
26-
name: INTEGRATION_NAME,
25+
return extendIntegration(parentIntegration, {
2726
options,
2827
setupOnce() {
2928
instrumentation = instrumentVercelAi();
30-
parentIntegration.setupOnce?.();
3129
},
3230
afterAllSetup(client) {
3331
// Auto-detect if we should force the integration when running with 'ai' package available
@@ -40,7 +38,7 @@ const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
4038
instrumentation?.callWhenPatched(() => addVercelAiProcessors(client));
4139
}
4240
},
43-
};
41+
});
4442
}) satisfies IntegrationFn;
4543

4644
/**

packages/server-utils/src/vercel-ai/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type VercelAiOptions = {
2626

2727
const _vercelAiIntegration = ((options: VercelAiOptions = {}) => {
2828
return {
29-
name: 'VercelAi',
29+
name: 'VercelAi' as const,
3030
setupOnce() {
3131
// Bail if this is not available
3232
if (!dc.tracingChannel) {

0 commit comments

Comments
 (0)