Uncaught TypeError: Object.setProtoTypeOf
-
Hello @gabyimagely,
You asked me to create a new thread for this so I’ll do my best to explain what is happening for us in relation to the above error code we are seeing within the console log.
The error we are seeing on SOME but not all sites is:
“Uncaught TypeError: Object.setProtoTypeOf called on null or undefined at Function.setProtoTypeOf (<anonymous>) at common.js?ver=3.2.4:150 at common.js?ver=3.2.4:241”
We have managed to trace this back to an undeclared array after the Polyfill for older browsers within this file: /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/static/common.js
Object.setPrototypeOf( window.galleries,
window.galleries is undefined.
We have not been able to find a conflict with another plugin however this is happening to some but not all sites. The only cause we can identify for this relies on the fact that your your common.js is loading last in the enqueue of javascript files and there maybe another plugin that is using the same JS variable and defining it. Where the (currently unknown), script is not present on some sites, the variable is naturally undefined – hence the error.
Furthermore, have not noticed any issues with other Javascript breaking due to the error however, we can only say that because your common.js appears to be the last to load in the stack. NGG Galleries appears to be operating normally with and without the error.
So to fix this, we have added the following just above the Polyfill (just above line 150) which echos similar code you already have on line 43. This has stopped the error and “resolved” the issue for us system wide.
if (typeof(window.galleries) == 'undefined'){ window.galleries = []; }
I can email a working example of the modified file if you wish to examine it.
Kind regards,
Shane
- The topic ‘Uncaught TypeError: Object.setProtoTypeOf’ is closed to new replies.