Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript error: TypeError: Cannot read properties of undefined (reading 'call') #2477

Closed
JannikHv opened this issue May 10, 2022 · 11 comments
Labels

Comments

@JannikHv
Copy link

PHP Version

7.4.13

Shopware Version

6.4.11.1

Expected behaviour

Have vendor JavaScript work (all.js).

Actual behaviour

JavaScript has error which breaks all other JavaScript:

TypeError: Cannot read properties of undefined (reading 'call')

Screenshot 2022-05-10 at 12 16 19

How to reproduce

Upgrade to the currently latest shopware version (6.4.11.1), clear cache, compile theme, open shop with console tab open (I was using Chrome).

@JannikHv JannikHv added the Bug label May 10, 2022
@PatrickKalka-SeriousByte

Same here: #152

@omni-primus
Copy link

I got this error because of a plugin. After deactivating it, the error disappeared. In my case it was the Google Translator Plugin by Bul Hinsche GmbH.

@JannikHv
Copy link
Author

I got this error because of a plugin. After deactivating it, the error disappeared. In my case it was the Google Translator Plugin by Bul Hinsche GmbH.

Gonna try deactivating each plugin one after another.

@JannikHv
Copy link
Author

Turns out, it was the Plugin Google Tag Manager & Google Analytics Enhanced E-Commerce Tracking für Shopware 6. Deactivation solved it for me. Thanks your comments anyway!

@Guite
Copy link
Contributor

Guite commented May 12, 2022

I doubt this issue is on the plugin side.
After having tested this on two sites, the following plugins are "affected" as well:

I had to disable them all to get my JavaScript working again.

Is it really probable that all these plugins have a problem with 6.4.11.x?
They all work fine with 6.4.10.x ...

@PatrickKalka-SeriousByte

I doubt this issue is on the plugin side. After having tested this on two sites, the following plugins are "affected" as well:

I had to disable them all to get my JavaScript working again.

Is it really probable that all these plugins have a problem with 6.4.11.x? They all work fine with 6.4.10.x ...

I can confirm about matomo. BUT not all the time. I was testing a lot to figure out which one is the bad guy. And sometimes 4/5 enabled works fine, but after changing and returning back to the working 4, not.

Maybe somehow about the installation order or something?

@tobiasberge
Copy link
Contributor

Hi everyone,

I reopened this issue for the moment since it seems to be a general thing. We are investigating what exactly caused the problem and will get back to you asap. One of our partners suspected a change inside pseudo-modal.util.js which added new exports. I was able to reproduce this with a test plugin, however the error message in the console was a different one.

I attached the change with which I could fix the test plugin when applied to version 6.4.11.1. But we will investigate further using your mentioned plugins. Sorry for the circumstances.

Index: src/Storefront/Resources/app/storefront/src/plugin/ajax-modal/ajax-modal.plugin.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Storefront/Resources/app/storefront/src/plugin/ajax-modal/ajax-modal.plugin.js b/src/Storefront/Resources/app/storefront/src/plugin/ajax-modal/ajax-modal.plugin.js
--- a/src/Storefront/Resources/app/storefront/src/plugin/ajax-modal/ajax-modal.plugin.js	(revision 10086920a14d6c33e357054e51283993603888f8)
+++ b/src/Storefront/Resources/app/storefront/src/plugin/ajax-modal/ajax-modal.plugin.js	(date 1652276437223)
@@ -4,7 +4,9 @@
 import LoadingIndicatorUtil from 'src/utility/loading-indicator/loading-indicator.util';
 import DeviceDetection from 'src/helper/device-detection.helper';
 import DomAccess from 'src/helper/dom-access.helper';
-import PseudoModalUtil, { PSEUDO_MODAL_TEMPLATE_CONTENT_CLASS } from 'src/utility/modal-extension/pseudo-modal.util';
+import PseudoModalUtil from 'src/utility/modal-extension/pseudo-modal.util';
+
+const PSEUDO_MODAL_TEMPLATE_CONTENT_CLASS = 'js-pseudo-modal-template-content-element';
 
 /**
  * This class extends the Bootstrap modal functionality by
Index: src/Storefront/Resources/app/storefront/src/utility/modal-extension/pseudo-modal.util.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Storefront/Resources/app/storefront/src/utility/modal-extension/pseudo-modal.util.js b/src/Storefront/Resources/app/storefront/src/utility/modal-extension/pseudo-modal.util.js
--- a/src/Storefront/Resources/app/storefront/src/utility/modal-extension/pseudo-modal.util.js	(revision 10086920a14d6c33e357054e51283993603888f8)
+++ b/src/Storefront/Resources/app/storefront/src/utility/modal-extension/pseudo-modal.util.js	(date 1652276407373)
@@ -2,10 +2,10 @@
 import Feature from 'src/helper/feature.helper';
 import { REMOVE_BACKDROP_DELAY } from 'src/utility/backdrop/backdrop.util';
 
-export const PSEUDO_MODAL_CLASS = 'js-pseudo-modal';
-export const PSEUDO_MODAL_TEMPLATE_CLASS = 'js-pseudo-modal-template';
-export const PSEUDO_MODAL_TEMPLATE_CONTENT_CLASS = 'js-pseudo-modal-template-content-element';
-export const PSEUDO_MODAL_TEMPLATE_TITLE_CLASS = 'js-pseudo-modal-template-title-element';
+const PSEUDO_MODAL_CLASS = 'js-pseudo-modal';
+const PSEUDO_MODAL_TEMPLATE_CLASS = 'js-pseudo-modal-template';
+const PSEUDO_MODAL_TEMPLATE_CONTENT_CLASS = 'js-pseudo-modal-template-content-element';
+const PSEUDO_MODAL_TEMPLATE_TITLE_CLASS = 'js-pseudo-modal-template-title-element';
 
 export default class PseudoModalUtil {
     constructor(

@tobiasberge tobiasberge reopened this May 13, 2022
@SorinSu
Copy link

SorinSu commented May 13, 2022

Hi

i had the same problem with SW 6.4.11.1 and this Plugin:
https://store.shopware.com/diga302677692244/conversion-tracking-google-ads-facebook-pinterest-microsoft....html

somehow, after i contacted the developer, he managed to fix it in short time

@Mardl
Copy link

Mardl commented May 18, 2022

@SorinSu do you know how the developer fixed it?
I had the same error on my local shopware instance.
I rebuild the script and it work fine now.
Maybe this help for you

@flinkfactory
Copy link

In my plugin it was the following import that caused the error:
import AjaxModalExtensionUtil from 'src/utility/modal-extension/ajax-modal-extension.util';

Can anyone verify if that might be their issue as well? I noticed that in NEXT-16624 - Add style and test fixes
something changed here.

@rustymcfly
Copy link

If anyone stumbles upon this in the future:
I've made a solution-post in the shopware-forum because i didn't find anything of value for this yet
https://forum.shopware.com/t/all-js-uncaught-typeerror-cannot-read-properties-of-undefined-reading-call-nach-update-auf-6-4-11-1/94346/23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants