diginov / craft-sentry-logger

Pushes Craft CMS logs to Sentry through a real Yii 2 log target.
MIT License
5 stars 7 forks source link

Plugin breaks Yii debugbar #12

Closed troyxmccall closed 7 months ago

troyxmccall commented 7 months ago

Description

Activating this plugin breaks the Craft CMS / Yii debug bar when a user is logged in and has profiling enabled:

A simple solution would be to add

$user = Craft::$app->getUser()->getIdentity();
$debugToolbarEnabled = $user ? $user->getPreference('enableDebugToolbarForSite') : false;

if ($debugToolbarEnabled) {
  return;
}

to your init() function

Steps to reproduce

  1. login to craft admin: /admin
  2. enable the debugbar for your user profile: /admin/myaccount Screen Shot 2024-01-10 at 1 49 32 PM
  3. save your user settings
  4. view your site, and open the network panel
  5. filter for XHR requests
  6. note that /actions/debug/default/toolbar?tag=xxx 404s

    Additional info

martinleveille commented 7 months ago

Hi @troyxmccall

I was not able to replicate the error you got. I tested with several installations having the same versions of Craft and plugin. I still get an HTTP 200 response on /actions/debug/default/toolbar?tag=[hash].

Are you able to replicate this error on other of your Craft installations?

Can you send me your composer.json to see if there are any conflicting packages?

sentry_logger_craft3_toolbar
troyxmccall commented 7 months ago

@martinleveille, thanks for looking into this!

It must be due to something chained if it works on a fresh install.

We can close this for now, and I'll dig into it and see if it's another dep or even one of my (inherited) custom modules - it'll probably take me a week or two to look into this bc it's not high on my priority list at work.

These are my composer packages, but I have a feeling it might be due to one of our private modules

"require": {
        "born05/craft-assetusage": "2.3.1",
        "craftcms/cms": "3.9.6",
        "craftcms/feed-me": "4.8.0",
        "craftcms/redactor": "2.10.12",
        "diginov/craft-sentry-logger": "1.3.4",
        "ext-mbstring": "*",
        "google/cloud-bigquery": "^1.23",
        "google/cloud-core": "^1.43",
        "google/gax": "^1.9",
        "perfectwebteam/craft-mailchimp-transactional": "1.0.3",
        "verbb/super-table": "2.7.5.1",
        "vlucas/phpdotenv": "^3.4.0"
    },

thanks again!

martinleveille commented 7 months ago

Thank you for the feedback. I'll still take a look at an installation with your composer.json.