Connehito/cake-sentry

CakeSentry.Client.afterCapture event is dispatched after ErrorController rendering.

jtraulle opened this issue · 1 comments

Following my use case of issue #3 I noticed that it never worked on the first time (but only the second time an exception/error is triggered).

For the v2.x of the plugin, the Event CakeSentry.Client.afterCapture that is used to set the last_event_id in session to pass it to the view is triggered after the rendering of my ErrorController so when I FIRST try to use the event id in my custom Error view, it is not defined, so it only works the second time (refresh) because the last_event_id is putted in session after the view rendering.

Any idea how to workaround that ?

I have solved my problem by integrating Sentry SDK directly to my CakePHP app without this plugin following this example (that I have a little tweaked to get working with CakePHP 4.0)

https://forum.sentry.io/t/accessing-getlasteventid-from-cakephp/6545/8