born05 / craft-sentry

Pushes Craft CMS errors to Sentry.
MIT License
9 stars 11 forks source link

Load Sentry JS SDK on front end requests. #12

Closed jamesmacwhite closed 3 years ago

jamesmacwhite commented 3 years ago

I got shot down on this request on the original project here: https://github.com/lukeyouell/craft-sentry/issues/19

But I'll give it another go. A Craft 2 version of a Sentry plugin loaded both the PHP SDK and the JS client on the front end for monitoring JS based exception. This was using the Raven SDK: https://docs.sentry.io/clients/javascript/ which is now deprecated and replaced by this SDK: https://docs.sentry.io/platforms/javascript/

While you don't need this plugin to implement the JS client, for neatness and given all of the Sentry values that can be configured will be easily pulled in from either the existing Sentry config options or Craft environment variables, would you consider extending this plugin to load the JS client on the front end with a Sentry.init call that loads in DSN, settings etc?

If not I will do it in a module instead, but just wondered as it was originally possible in Craft 2.

jamesmacwhite commented 3 years ago

In fact I think it might have been you @born05 who did it:

https://github.com/born05/craft2-sentry/blob/master/SentryPlugin.php#L200

jamesmacwhite commented 3 years ago

Closed by #13