Skip to content
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
8 changes: 8 additions & 0 deletions packages/vercel-edge/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export {
setAttribute,
setAttributes,
setUser,
setConversationId,
getSpanStatusFromHttpCode,
setHttpStatus,
withScope,
Expand Down Expand Up @@ -92,9 +93,11 @@ export {
spanToJSON,
spanToTraceHeader,
spanToBaggageHeader,
updateSpanName,
consoleLoggingIntegration,
createConsolaReporter,
featureFlagsIntegration,
growthbookIntegration,
logger,
metrics,
withStaticSpan,
Expand All @@ -114,10 +117,15 @@ export {
createLangChainCallbackHandler,
instrumentLangChainEmbeddings,
instrumentStateGraph,
instrumentCreateReactAgent,
} from '@sentry/server-utils/no-diagnostic-channels';

export { VercelEdgeClient } from './client';
export { getDefaultIntegrations, init } from './sdk';

export { winterCGFetchIntegration } from './integrations/wintercg-fetch';
export type { FetchIntegrationOptions } from '@sentry/core';

// vercelAIIntegration and prismaIntegration require diagnostics channels, unavailable on Vercel Edge.
// Cloudflare's httpServerIntegration is consumed by its request wrapper, which Vercel Edge does not use.
// The fetch-based spotlightIntegration lives in the Cloudflare package, not a shared entry point.
48 changes: 48 additions & 0 deletions packages/vercel-edge/test/exports.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { SentrySpan } from '@sentry/core';
import { afterEach, describe, expect, it } from 'vitest';
import {
getIsolationScope,
growthbookIntegration,
instrumentCreateReactAgent,
setConversationId,
updateSpanName,
} from '../src';

afterEach(() => {
setConversationId(null);
});

describe('portable exports', () => {
it('sets the conversation context through the public entry point', () => {
setConversationId('edge-conversation');

expect(getIsolationScope().getScopeData().conversationId).toBe('edge-conversation');
});

it('updates a span name through the public entry point', () => {
const span = new SentrySpan({ name: 'original' });
updateSpanName(span, 'renamed');
expect(span.getSpanJSON().name).toBe('renamed');
span.end();
});

it('creates the GrowthBook integration through the public entry point', () => {
class GrowthBook {
public isOn(): boolean {
return true;
}
public getFeatureValue(): unknown {
return false;
}
}

expect(growthbookIntegration({ growthbookClass: GrowthBook }).name).toBe('GrowthBook');
});

it('wraps a React agent factory and preserves its result', () => {
const graph = {};
const createAgent = instrumentCreateReactAgent(() => graph);

expect(createAgent()).toBe(graph);
});
});
Loading