diff --git a/packages/core/test/lib/transports/base.test.ts b/packages/core/test/lib/transports/base.test.ts index 5e6b504d9f6e..e6f33e20e757 100644 --- a/packages/core/test/lib/transports/base.test.ts +++ b/packages/core/test/lib/transports/base.test.ts @@ -23,7 +23,7 @@ const ATTACHMENT_ENVELOPE = createEnvelope( length: 20, filename: 'test-file.txt', content_type: 'text/plain', - attachment_type: 'text', + attachment_type: 'event.attachment', }, 'attachment content', ] as AttachmentItem, diff --git a/packages/types/src/attachment.ts b/packages/types/src/attachment.ts index 55cc795732ea..da7678d1d8f1 100644 --- a/packages/types/src/attachment.ts +++ b/packages/types/src/attachment.ts @@ -1,6 +1,23 @@ +export type AttachmentType = + | 'event.attachment' + | 'event.minidump' + | 'event.applecrashreport' + | 'unreal.context' + | 'unreal.logs'; + +/** + * An attachment to an event. This is used to upload arbitrary data to Sentry. + * + * Please take care to not add sensitive information in attachments. + * + * https://develop.sentry.dev/sdk/envelopes/#attachment + */ export interface Attachment { data: string | Uint8Array; filename: string; contentType?: string; - attachmentType?: string; + /** + * The type of the attachment. Defaults to `event.attachment` if not specified. + */ + attachmentType?: AttachmentType; } diff --git a/packages/types/src/envelope.ts b/packages/types/src/envelope.ts index fe08ce1962d1..5db39eb65f3e 100644 --- a/packages/types/src/envelope.ts +++ b/packages/types/src/envelope.ts @@ -1,3 +1,4 @@ +import type { AttachmentType } from './attachment'; import type { SerializedCheckIn } from './checkin'; import type { ClientReport } from './clientreport'; import type { DsnComponents } from './dsn'; @@ -72,7 +73,7 @@ type AttachmentItemHeaders = { length: number; filename: string; content_type?: string; - attachment_type?: string; + attachment_type?: AttachmentType; }; type UserFeedbackItemHeaders = { type: 'user_report' }; type FeedbackItemHeaders = { type: 'feedback' };