diff --git a/packages/core/src/envelope.ts b/packages/core/src/envelope.ts index 0a4cd6a87870..5e79d1707d67 100644 --- a/packages/core/src/envelope.ts +++ b/packages/core/src/envelope.ts @@ -48,7 +48,7 @@ export function createSessionEnvelope( }; const envelopeItem: SessionItem = - 'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session]; + 'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session.toJSON()]; return createEnvelope(envelopeHeaders, [envelopeItem]); } diff --git a/packages/types/src/envelope.ts b/packages/types/src/envelope.ts index 3bcb8e96da7d..3f3ebf999ef9 100644 --- a/packages/types/src/envelope.ts +++ b/packages/types/src/envelope.ts @@ -4,7 +4,7 @@ import type { DsnComponents } from './dsn'; import type { Event } from './event'; import type { ReplayEvent, ReplayRecordingData } from './replay'; import type { SdkInfo } from './sdkinfo'; -import type { Session, SessionAggregates } from './session'; +import type { SerializedSession, Session, SessionAggregates } from './session'; import type { Transaction } from './transaction'; import type { UserFeedback } from './user'; @@ -76,7 +76,8 @@ export type EventItem = BaseEnvelopeItem; export type AttachmentItem = BaseEnvelopeItem; export type UserFeedbackItem = BaseEnvelopeItem; export type SessionItem = - | BaseEnvelopeItem + // TODO(v8): Only allow serialized session here (as opposed to Session or SerializedSesison) + | BaseEnvelopeItem | BaseEnvelopeItem; export type ClientReportItem = BaseEnvelopeItem; export type CheckInItem = BaseEnvelopeItem;