Troubleshooting Debugbar Module

SilverStripe Version 4.2.1

Question:
I’ve installed lekoala/silverstripe-debugbar using composer, but the widget isn’t being rendered on the front or back end.

I added this on the PageController class, which I saw in a forum post for a similar problem with this module:

use LeKoala\DebugBar\DebugBar;
public function RenderDebugBar() {
  if (DebugBar::renderDebugBar()) {
    return DebugBar::renderDebugBar();
  } else {
    var_dump(DebugBar::renderDebugBar());
  }
}

and then call it in the Page.ss template like this:

$RenderDebugbar

But it returns null.

I can confirm that I have no inline scripts, which is mentioned as a possible problem. and ?showqueries returns some info.

  • LeKoala\DebugBar\Proxy\SSViewerProxy->process(HomePageController, Array, SilverStripe\View\SSViewer_DataPresenter)
    SSViewer.php:764
  • LeKoala\DebugBar\Proxy\SSViewerProxy->process(HomePageController)
    Controller.php:303
  • LeKoala\DebugBar\Middleware\DebugBarMiddleware->process(SilverStripe\Control\HTTPRequest, Closure)
    HTTPMiddlewareAware.php:62

Are there any other tests I can try other than doing a fresh install of SilverStripe and then re-installing the module?

Is your site in dev mode? I haven’t used this module before but I see that’s a requirement for the bar to render.

I have this set in .env:

SS_ENVIRONMENT_TYPE="dev"

There’s a method you can use to find out why it’s disabled: silverstripe-debugbar/DebugBar.php at master · lekoala/silverstripe-debugbar · GitHub

1 Like

I added this to the PageController class:

public function whyDisabled() {
  return DebugBar::whyDisabled();
}

And call it in Page.ss template, which returns this message: "Not a local IP"

I have a configuration YAML set up with the following:

---
Name: mysite #This should match the Site Name set in mysite.yml/app.yml
---
LeKoala\DebugBar\DebugBar:
  enabled_in_admin: true
  query_limit: 500

I’ve added this line:

  check_local_ip: false

and did a Dev/Flush and it now seems to be working.

Thanks!