Jump to content

Uncaught TypeError: window.Tracy.Debug.bar is undefined


Ivan Gretsky
 Share

Recommended Posts

Good day, @adrian!

I am debugging an Admin Action (yes, another module of your's)). I get an error and try to debug with bd(). I can see the Tracy bar and the dumps count appear. But then I hover the cart with dumps popup doesn't show. Actually no popups in the bar work.

I get this message in the browser dev tools console:
1229700931_.png.88fbb6b5cff079a294721931faa248a7.png

I also notice, that the Tracy code is added to the document twice:
342776370_.thumb.png.8e871001e2f069f0ffedb2c94c84e7d8.png

Why can that happen? Tracy seem to work as it should on other pages.

Link to comment
Share on other sites

Hi @Ivan Gretsky - thanks for the file. Unfortunately I can't reproduce yet. I thought perhaps you might have been bootstrapping PW into the action or something like that. Seeing Tracy loaded twice like that is definitely weird. Do you only see that with this action, or any Admin Action?

Does it show up when loading the action, or only after running it?

Link to comment
Share on other sites

I am running this action just like any other. But it does end up with an error (which I am trying to debug) and a Bluescreen (Redscreen would be a better term here))).

I do not see this on any other actions I run, though I didn't try to make them end with an error.

I does show only when I am running it and get an error.

Link to comment
Share on other sites

  • 3 months later...

I think the issue here is that Tracy is running 2x, and thus the JS error;

For me this usually happens if i am doing an ajax call to an endpoint and that endpoint is still allowing Tracy to run; I couldn't stop tracy with an exit() like i was able to do in the past for some reason, so i had to disable the template in the module settings.

Link to comment
Share on other sites

@Macrura -  If this is something you can reproduce easily, would you mind seeing if adding: 

if(!Debugger::isEnabled()) 

at the start of this line (https://github.com/adrianbj/TracyDebugger/blob/24dcacfc864447a41676b0f12eeb901512c0d2eb/TracyDebugger.module.php#L1393) helps?

If that doesn't work, then perhaps adding:

if(Debugger::isEnabled()) return;

at the top of the init() and ready() methods might work?

Thanks a lot for testing these.

 

See revised version below!

Link to comment
Share on other sites

@Macrura and @Ivan Gretsky - I haven't seen the exact issue you are seeing, but I did have a site that pulls in data from another PW instance that wasn't showing the debug bar. I fixed it by adding:

if(class_exists('\Tracy\Debugger') && Debugger::isEnabled()) return;

as the first line in the module's init() method.

I'd love if you could test that please and see if it helps your issues.

Thanks,
Adrian

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...