Uncaught TypeError: Cannot read properties of undefined (reading ‘hooks’)
-
Hello. After the latest updates, I have this problem in the console
`Uncaught TypeError: Cannot read properties of undefined (reading ‘hooks’)
at gtag-events.js:1:42
at gtag-events.js:1:1973
(анон?мно) @ gtag-events.js:1
(анон?мно) @ gtag-events.js:1The page I need help with: [log in to see the link]
-
Hi @hoseua
The gtag-events.js relies on the WP hooks script to be loaded. When I browse to the cart or my-account pages I notice that the script is loaded from
https://c0.wp.com/c/6.0.1/wp-includes/js/dist/hooks.min.js
and there is no console error. However on other pages I can see the console error because the script is not loaded.The code on the other pages does seem to be loaded in a combined JS file from
wp-content/litespeed/js/f3efac0162336e2e3a3d2adfb4a12c7b.js
but it’s loaded after the gtag-events.js file. I’m not familiar with how the caching from litespeed works, but is it possible to change the order in which those two scripts are loaded?Thanks for the answer, but this problem appeared after updating your plugin. Litespeed was not updated
Hi @hoseua
this problem appeared after updating your plugin. Litespeed was not updated
Can you please temporarily disable LiteSpeed cache and see if that makes a difference?
This tutorial explains how you can do it: https://support.hawkhost.com/Knowledgebase/Article/View/how-do-i-enable-disable-or-flag-litespeed-cache-for-wordpress
Good day.
Yes, disabling cache on the server fixes the problem. But rolling back your plugin to an older version, even with cache enabled, also fixes the problem.Hi @hoseua
disabling cache on the server fixes the problem. But rolling back your plugin to an older version, even with cache enabled, also fixes the problem.
Thanks for sharing this observation.
As this seems to be a bug, a good move would be to report this to the developers. You can do that here: https://github.com/woocommerce/google-listings-and-ads/issues
You’ll want to give them the exact steps to follow to reproduce the issue.
Thanks
As this seems to be a bug, a good move would be to report this to the developers.
Isn’t this a plugin support forum?
Hi @hoseua
We checked further but couldn’t reproduce the issue on our end.
We observed that if it was an issue with Google Listings & Ads itself then the issue would still have occurred with the cache disabled, which is not the case here (per your response).
Can you please take the following steps?
1. Update the Google Listings & Ads plugin to its latest version.
2. Clear and disable the cache.
3. Also disable any other optimization plugins which are minifying JavaScript on the site to see if the behavior persists.
Apart from disabling the cache it is essential to clear old, cached files.
Please share the result of this test here. This test will help confirm if the issue is due to caching or minification of JavaScript files rather than being an issue with the Google Listings & Ads plugin itself.
Thank you for your reply.
But I have already done all this, according to the instructions you posted a little above. If you disable the cache on the server, there is no error.
For the clarity of the answer, I will repeat once again – everything worked without errors until YOUR update.Hi @hoseua,
For the clarity of the answer, I will repeat once again – everything worked without errors until YOUR update.
This is clear but the error could be likely caused by a conflicting theme or plugin clashing with the latest code from Google Listings & Ads. Do you mind following the steps of a full conflict test and checking if you still see those errors in the console?
You can find a more detailed explanation on how to do a conflict test here:
https://docs.woocommerce.com/document/how-to-test-for-conflicts/.
If that doesn’t help, kindly provide us the following for further troubleshooting:
- System Status: You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”. Once you’ve done that, paste it here in your response.
- Fatal Error Log: Share a copy of any fatal error log found under WooCommerce > Status > Logs (if available).
- A screenshot of the console errors
Thanks!
Hello @rainfallnixfig
Thank you for your participation in solving the problem.
It seems that the problem disappears when litespeed is disabled in the settings – combining javascript. But I need this item enabled.
I cannot post information from the status systems, because there is a lot of sensitive information.
I add fatal error logs.https://snipboard.io/l4gpKG.jpg
https://snipboard.io/rnF4Eh.jpg
https://snipboard.io/6Ay23D.jpgHi @hoseua,
Thanks for sending over Google Listings & Ads logs.
It seems that the problem disappears when litespeed is disabled
This makes me think that there seems to be a compatibility issue with the LiteSpeed cache plugin. Make sure the plugin is up to date and contact the LiteSpeed support team to report the issue.
I cannot post information from the status systems, because there is a lot of sensitive information.
The system status report does not contain sensitive information like user details or card data. Sending over the system status is a common practice on the forums and most users remove the website’s URL so as to not show any reference.
Best.
Hi @rainfallnixfig
I cannot understand your logic. There is a system that works, YOU update YOUR plugin, the system starts returning an error, and another plugin is to blame… How is it?
I expect you to either fix YOUR problems with YOUR plugin, or YOUR plugin will be removed and its performance evaluated accordingly.
Thank you.Hi @hoseua
Apologies for any confusion but please note that other users of the Google Listings & Ads extension are not facing this problem. This indicates that some combination in your specific setup is causing a trouble.
It has already been tested and confirmed that the issue disappears upon clearing the cache.
The other reason could be that due to the JavaScript files being combined by what looks like LiteSpeed cache it’s not correctly loading those and causing an error. Or again, it’s loading old versions of the JavaScript files.
Had you tried disabling any other optimization plugins which are minifying JavaScript on the site to see if the behavior persists?
Hi @margaretwporg
I don’t use any other cache or minification plugins.
But you should understand – the error disappears in two cases, when you disable combining and when i am disable your plugin. In version 2.0.2, everything worked as it should. Thank you.Hey @hoseua,
Please do not use all caps since it is equivalent to shouting in the forum netiquette ??. You can read more about our forum guidelines here.
the problem disappears when litespeed is disabled
The logic is that, once Google Listings & Ads is updated, the code in it is also changed/updated and this may cause a conflict with other code contained in tools running on the site, particularly themes or third-party plugins like LiteSpeed cache.
We do ensure compatibility with products developed by WooCommerce and with WordPress but we cannot be sure that we can solve issues arising from third-party products or services developed by others.
There seems to be a compatibility report with LiteSpeed cache on this Github thread, so you can add your comments to it and share the errors generated in the console with the developers. They’re in the best position to address this specific issue.
Let us know if you have any more questions.
- The topic ‘Uncaught TypeError: Cannot read properties of undefined (reading ‘hooks’)’ is closed to new replies.