Digitalist-Open-Cloud / Matomo-Plugin-Sentry

Log all Matomo errors to a Sentry server
https://digitalist.cloud/
GNU General Public License v3.0
4 stars 2 forks source link

fix matomo >=4.0.0 compatibility #4

Closed JanMalte closed 8 months ago

JanMalte commented 3 years ago

please update the compatibility to work with matomo >= 4.0.0

let me know if there is help needed and what we could do to push this forward.

Findus23 commented 3 years ago

Hi,

I didn't want to simply update the plugin as I stopped using sentry and didn't want to publish it without testing.

If you want to, I can update the composer dependencies and mark the plugin as 4.x compatible and you could test it before I publish it.

Findus23 commented 3 years ago

Hi,

You can find a hopefully Matomo 4 compatible version of the plugin in the 4.x-dev branch: https://github.com/Findus23/plugin-SentryLogger/tree/4.x-dev

uhlhosting commented 3 years ago

@Findus23 the latest dev branch its simply broken for some reason after installing the latest 4.x-dev branch, I get this:

An error occurred Package "sentry/sentry" is not installed

the worst outcome of this, is that will render unusable the entire Matomo, they should have a better failsafe in place, or sorry is not possible one module will kill entire app. Thats a very poor application baseline for failsafe.

cosmic@trace:/var/www/html/matomo$ php console plugin:activate SentryLogger

ERROR [2021-01-26 23:49:04] 27870  Uncaught exception: /var/www/html/matomo/vendor/composer/InstalledVersions.php(584): Package "sentry/sentry" is not installed
Package "sentry/sentry" is not installed

  [OutOfBoundsException]                    
  Package "sentry/sentry" is not installed  

plugin:activate [plugin1] ... [pluginN]
cosmic@trace:/var/www/html/matomo$ php console plugin:uninstall SentryLogger
ERROR [2021-01-26 23:49:07] 27884  Uncaught exception: /var/www/html/matomo/vendor/composer/InstalledVersions.php(584): Package "sentry/sentry" is not installed
Package "sentry/sentry" is not installed

  [OutOfBoundsException]                    
  Package "sentry/sentry" is not installed  

plugin:uninstall [plugin1] ... [pluginN]
cosmic@trace:/var/www/html/matomo$ 
Findus23 commented 3 years ago

Hi,

The very concept of this plugin is (as mentioned in the description) very experimental and creating a separate vendor directory from the Matomo one is not how it is intended to be used and also the way Sentry is integrated is not really proper.

I created this plugin a while ago to quickly find exceptions in Matomo during testing and shared it in case someone else also found it useful, but then stopped using sentry and therefore also didn't use the plugin anymore.

For your error I quickly tested it locally and I can enable the plugin without any errors, so I don't have any idea what could be the reason. But deleting the plugin/SentryLogger directory and the entries in the config/config.ini.php should get your Matomo instance working again.

Findus23 commented 3 years ago

@tsteur I now tried testing this on my live Matomo instance and indeed I get the same error.

It occurs on this line: https://github.com/Findus23/plugin-SentryLogger/blob/6686f1003fd19a75deee21f14c0a7afd07d4e44f/SentryLogger.php#L32 which makes me think this is an autoloading issue. Weirdly using composer for Matomo plugins should work (even the premium plugins do it). But maybe there is something weird when combining composer 2 with composer 1. In my local dev instance everything works fine, so it might just be an issue with the released matomo package.

I can't think of any way to solve this so I'll probably just leave it as is until someone more familiar with composer comes across this.

tsteur commented 3 years ago

Maybe @diosmosis or @sgiehl know more? I'm not so much into this unfortunately. If that's indeed the case we can't even easily change the composer version when packaging as it would maybe break other plugins.

diosmosis commented 3 years ago

Not sure what the issue could be, but to test locally I'd download the vendor directories on your server locally and see if using those reproduces the issue locally. Then it'd be easier to debug at least.

mikkeschiren commented 8 months ago

As Matomo 5 now is out, and we will have a branch for that, I am closing this.