Skip to content

Bring back lastEventId API #11951

Closed
@Lms24

Description

@Lms24

Problem Statement

The king is dead, long live the king...

We removed lastEventId in #10585 due to several shortcomings of this API:

  • It would return potentially unexpected event ids, for example when multiple errors were caught in sequence
  • The last eventId was updated directly in captureEvent, before processing and sending the event. Meaning, if users or our event processors dropped the event, lastEventId would return an id of an event that wasn't ever sent from the SDK.
  • Depending on how Hub was used, it could potentially bleed through requests/"leak" an event id of another request if there was no proper request isolation set up.

Solution Brainstorm

In an effort to minimize friction we should bring back this API:

  • Store it on the isolation scope (--> ideally avoids cross-request bleeds on server; doesn't matter for browser)
  • Update the last event id on the isolation scope directly before sending the event (i.e. when chances are low that the event is still dropped on the client side)
  • Unchanged to previous implementation: only update the id with error events
  • Add a big warning that this API returns potentially nonsense
### Tasks
- [ ] https://github.com/getsentry/sentry-javascript/pull/12022
- [ ] https://github.com/getsentry/sentry-javascript/pull/12029
- [ ] https://github.com/getsentry/sentry-javascript/pull/12042
- [x] Update migration docs
- [ ] https://github.com/getsentry/sentry-docs/pull/10127

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions