Skip to main content

How can I give an event ID to the end-user?

Updated over a month ago

Issue

I want to provide my end-users with an internal error number (such as a Sentry event or issue ID) when a runtime error occurs.

Resolution

When an error occurs in your application you can collect the event ID returned by the SDK and present it to the end-user. This will help aide correlating Sentry events in your dashboard with user reports like support tickets.

  • Example in ASP.NET:

var eventId = SentrySdk.CaptureException(exception);
return $"Error ID: {eventId}";

Some things to note:

  1. Issue ID does not exist at the time of error:

    • When an error occurs, an event ID is generated by the Sentry SDK, but the issue ID only forms after events are grouped by Sentry's backend. Therefore, you cannot provide an issue ID at the time of the error - this a common misconception.

  2. Event might not reach Sentry:

    • Some events may not be stored due to inbound filters, rate limits, or other reasons. Even if a valid event ID is generated, and the network details show a 2xx response the collected eventID may not correspond to an event stored in Sentry.

Did this answer your question?