Using getLastEventId
in Laravel Lumen
#555
-
Hello! We’d like to create an error page with a sentry feedback form for the couple routes that return HTML, if a request results in an error However, app(‘sentry’) is not available in lumen. However, we were able to find a workaround for toTraceParent, so is there a more direct way we get that info? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @androidacybot, You should not use The last event ID comes from the "hub" in the Sentry SDK and you can get the hub using: Let me know if that worked! |
Beta Was this translation helpful? Give feedback.
Hi @androidacybot,
You should not use
toTraceParent
this is not the last event ID but the current transaction ID. Unless you are using performance monitoring this value will be empty or invalid, it also includes other data next to the transaction ID, so it's not really meaningful in the feedback context.The last event ID comes from the "hub" in the Sentry SDK and you can get the hub using:
\Sentry\SentrySdk::getCurrentHub()
, from there you can request the last event ID like so:\Sentry\SentrySdk::getCurrentHub()->getLastEventId()
. This "hub" is what you would resolve from the container usingapp('sentry')
.Let me know if that worked!