Home › Forums › Bug Reports › Intermittent Javascript Error prevents page from rendering
We are seeing an intermittent error on this page:
https://eatlocalfirst.org/wa-food-farm-finder/
It happens a couple times a day, when it happens the page does not render correctly. After a few refreshes it goes away. I am guessing that its an order of operations problem. Any idea how to fix?
jquery.min.js?ver=3.6.4:2 Uncaught TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at acf.Model.addProLocations (VM10697 acf-field-group.min.js:1:25473)
at acf.Model.initialize (VM10697 acf-field-group.min.js:1:25199)
at acf.Model.e (acf.min.js?ver=6.1.7:1:3283)
at o (acf.min.js?ver=6.1.7:1:1417)
at Object.doAction (acf.min.js?ver=6.1.7:1:587)
at n.doAction (acf.min.js?ver=6.1.7:1:19465)
at HTMLDocument.<anonymous> (acf.min.js?ver=6.1.7:1:28734)
at e (jquery.min.js?ver=3.6.4:2:30158)
at t (jquery.min.js?ver=3.6.4:2:30460)
Turns out I am having a different issue that is breaking the page.
But that function is still having an error.
in acf-field-groups.js addProLocations function.
ProLocationTypes is null but its object type is still an object. So the Object.entries function is triggering an error.
I am experiencing this as well. I cannot make changes to an existing group.
TypeError: Cannot convert undefined or null to object
at Function.entries (<anonymous>)
at acf.Model.addProLocations (acf-field-group.min.js?ver=6.2.0:1:25790)
at acf.Model.initialize (acf-field-group.min.js?ver=6.2.0:1:25516)
at acf.Model.e (acf.min.js?ver=6.2.0:1:3259)
at o (acf.min.js?ver=6.2.0:1:1405)
at Object.doAction (acf.min.js?ver=6.2.0:1:575)
at n.doAction (acf.min.js?ver=6.2.0:1:19006)
at HTMLDocument.<anonymous> (acf.min.js?ver=6.2.0:1:28275)
at e (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2.2:2:30158)
at t (load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,wp-polyfill-inert,regenerator-runtime,wp-polyfill,wp-hooks&ver=6.2.2:2:30460)
You should contact the developers or open a ticket in your account.
Also, you might want to enable script debugging to get a more accurate idea of where there errors are happening.
The issue had come and gone, but has resurfaced again with the latest version of ACF Pro (6.3.8) so I was just revisiting today.
It appears that they have wrapped the localization script for a value (isLicenseActive) that is used by addProLocations in an if (is_admin()) script. (acf-pro.php line 127) So it is not available on the front end causing that js error.
Adding the following to your js enqueue function seems to solve the problem. I am also going to open a bug on the issue.
$to_localize = array(
'isLicenseActive' => acf_pro_is_license_active(),
'isLicenseExpired' => acf_pro_is_license_expired(),
);
acf_localize_data( $to_localize );
@pattyok I wasn’t seeing the error on a clean WP install with no other plugins, so I re-added other plugins one by one and found that WPGraphQL for ACF was actually triggering the bug for me. I will give your code a try, as it would be nice to be able to have both plugins activated and still be able to edit custom fields. Thanks for your quick reply!
Have you received any feedback on your bug report @pattyok? I’m asking because we’re experiencing the same bug on a number of sites (we’ve tested up to ACF 6.3.12) and I’m reluctant to include a workaround on multiple sites when there may be a proper fix available.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.