Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method JustBetter\Sentry\Plugin\MonologPlugin::addAlert() #95

Closed
peterjaap opened this issue Jun 15, 2022 · 3 comments

Comments

@peterjaap
Copy link
Contributor

I have a clean Magento 2.4.4 on PHP 8.1 install with this plugin installed.

I configured Sentry by adding the sentry array with the correct info to app/etc/env.php, and imported the config.

Now I try to do a test event from the backend but I get the error "A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.".

When I look in the logs, I see this;

[2022-06-15T12:37:37.300585+00:00] .CRITICAL: Error: Call to undefined method JustBetter\Sentry\Plugin\MonologPlugin::addAlert() in /data/web/releases/20220615110641/vendor/justbetter/magento2-sentry/Controller/Adminhtml/Test/Sentry.php:92
Stack trace:
#0 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(58): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry->execute()
#1 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(138): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->___callParent()
#2 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(153): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->Magento\Framework\Interception\{closure}()
#3 /data/web/releases/20220615110641/generated/code/JustBetter/Sentry/Controller/Adminhtml/Test/Sentry/Interceptor.php(23): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->___callPlugins()
#4 /data/web/releases/20220615110641/vendor/magento/framework/App/Action/Action.php(111): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->execute()
#5 /data/web/releases/20220615110641/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#6 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#7 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(138): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->___callParent()
#8 /data/web/releases/20220615110641/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(145): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->Magento\Framework\Interception\{closure}()
#9 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#10 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(153): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->Magento\Framework\Interception\{closure}()
#11 /data/web/releases/20220615110641/generated/code/JustBetter/Sentry/Controller/Adminhtml/Test/Sentry/Interceptor.php(32): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->___callPlugins()
#12 /data/web/releases/20220615110641/vendor/magento/framework/App/FrontController.php(245): JustBetter\Sentry\Controller\Adminhtml\Test\Sentry\Interceptor->dispatch()
#13 /data/web/releases/20220615110641/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#14 /data/web/releases/20220615110641/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#15 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#16 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#17 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#18 /data/web/releases/20220615110641/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#19 /data/web/releases/20220615110641/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#20 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()
#21 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent()
#22 /data/web/releases/20220615110641/vendor/justbetter/magento2-sentry/Plugin/GlobalExceptionCatcher.php(78): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#23 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(135): JustBetter\Sentry\Plugin\GlobalExceptionCatcher->aroundLaunch()
#24 /data/web/releases/20220615110641/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}()
#25 /data/web/releases/20220615110641/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins()
#26 /data/web/releases/20220615110641/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#27 /data/web/releases/20220615110641/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#28 {main} [] []

Any ideas what could cause this?

@MeCapron
Copy link

MeCapron commented Jul 3, 2022

Hello,

Could you add the patch to the core version please?

Index: vendor/justbetter/magento2-sentry/Controller/Adminhtml/Test/Sentry.php
diff --git a/Controller/Adminhtml/Test/Sentry.php b/Controller/Adminhtml/Test/Sentry.php
--- a/vendor/justbetter/magento2-sentry/Controller/Adminhtml/Test/Sentry.php
+++ b/vendor/justbetter/magento2-sentry/Controller/Adminhtml/Test/Sentry.php	(date 1656347984101)
@@ -89,7 +89,7 @@
         if ($activeWithReason['active']) {
             try {
                 if ($this->helperSentry->isPhpTrackingEnabled()) {
-                    $this->monologPlugin->addAlert('TEST message from Magento 2', []);
+                    $this->monologPlugin->addRecord(\Monolog\Logger::ALERT, 'TEST message from Magento 2', []);
                     $result['status'] = true;
                     $result['content'] = __('Check sentry.io which should hold an alert');
                 } else {

peterjaap added a commit to peterjaap/magento2-sentry that referenced this issue Jul 5, 2022
@peterjaap
Copy link
Contributor Author

#98

indykoning pushed a commit that referenced this issue Jul 7, 2022
@indykoning
Copy link
Member

This has now been fixed as of version 3.2.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants