Issue
I am trying to set up Rails user feedback and need to pass the event_id to the frontend. Following these docs, I am unable to access the sentry.error_event_id that the Ruby SDK is supposed to be setting to the env.
Applies To
Rails SDK users
Rails SDK user feedback users
Resolution
The Rails and Rack middleware integrations set the ID of the event they capture in the Rack env, under the key sentry.error_event_id. If you capture an error another way, for example with a manual capture_exception call, the middleware does not set the env.
Sentry.capture_exception returns the captured event, so you can read its event_id, set it in the env yourself, and pass it to your frontend:
event = Sentry.capture_exception(exception)
env["sentry.error_event_id"] = event.event_id if event
