CakePHP 4.7 and DebugKit 4. 8 missing

My Debug toolbar has suddenly gone missing. There are no javascript errors indicating a problem with the actual toolbar, but all the code loading the plugin also remains in place. Checking and double checking my environment variables, I find DEBUG set to true. I see no error messages in my log files: it’s almost as if I’ve uninstalled the plugin, but I haven’t.

Anyone experiencing this issue?

If you use some different top level domain then those defined in the plugin

you have to manually specify you TLD as a “safeTld” via adding this to your app_local.php

'DebugKit' => [
    'safeTld' => ['com'],
]

Which will then let the DebugKit load for any *.com domain.

See Debug Kit - 4.x

Thank you for your reply. However, the debug kit has been working for a while now and the TLD is set. So that’s not it, but I appreciate the response.

Well the whole Debug Kit initialization happens via injecting

<script id="__debug_kit" data-id="40909db3-9120-4500-b87f-f2e0bc0f1a6c" data-url="https://localhost/" src="/debug_kit/js/toolbar.js?1654630629"></script>

at the end of the body. This JS then injects an iframe which then shows the Debug Kit Toolbar at the bottom.

If you don’t have that script tag at the end of your HTML then the DebugKitMiddleware didn’t run (or had problems injecting that iframe)

1 Like

But we’re not supposed to have to put that link directly into our templates, right? That’s why we do this:

<?= $this->fetch('scriptBottom'); ?>

I’ve never manually loaded the DebugKit, so I’m not sure that’s what’s necessary now. Your link doesn’t obviously work because it’s specific to your setup.

No, you don’t need to add that script tag yourself because it gets added via DebugKitMiddleware as you see here:

and

So just make sure your debug mode is on and your TLD is marked as safe as talked above.
With that the DebugKitMiddleware should be loaded and therefore the script tag should be added to your body automatically.

Thanks for that. This is an existing application that’s been working in the past. But of course, I double checked that debug mode is on, which it is:
.env:

export DEBUG=true

The plugin is further being loaded in Application.php:

        if (Configure::read('debug')) {
            $this->addPlugin('DebugKit');
        }

Meanwhile, I’m working on localhost, so there’s no worries about the TLD. So I’m at a loss as to what is preventing it from loading. There are no console errors, nor is the javascript even being included on the page, that I can see.

the .env file will only be loaded if you enable these lines of code in the config/bootstrap.php