Sentry can enrich your events for further investigation by storing additional files, such as config or log files, as attachments.
You'll first need to import the SDK, as usual:
import * as Sentry from "@sentry/nextjs";
To add an attachment, create an event processor that uploads files to the attachment endpoint in a multipart form data request. This requires associating the attachment with the event using its ID:
Sentry allows at most 100MB of attachments per event, including the crash report file (if applicable) Uploads exceeding this size are rejected with HTTP error
413 Payload Too Large and the data is dropped immediately. To add larger or more files, consider secondary storage options.
Attachments persist for 30 days; if your total storage included in your quota is exceeded, attachments will not be stored. You can delete attachments or their containing events at any time. Deleting an attachment does not affect your quota - Sentry counts an attachment toward your quota as soon as it is stored.
Learn more about how attachments impact your quota.
To limit access to attachments, navigate to your organization's General Settings, then select the Attachments Access dropdown to set appropriate access — any member of your organization, the organization billing owner, member, admin, manager, or owner.
By default, access is granted to all members when storage is enabled. If a member does not have access to the project, the ability to download an attachment is not available; the button will be greyed out in Sentry. The member may only view that an attachment is stored.
Attachments display on the bottom of the Issue Details page for the event that is shown.
Alternately, attachments also appear in the Attachments tab on the Issue Details page, where you can view the Type of attachment, as well as associated events. Click the Event ID to open the Issue Details of that specific event.