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

Error - is not a function: require(['domReady!'], function() #238

Open
jesperbrejning opened this issue Mar 14, 2023 · 5 comments
Open

Error - is not a function: require(['domReady!'], function() #238

jesperbrejning opened this issue Mar 14, 2023 · 5 comments

Comments

@jesperbrejning
Copy link

Environment details

PHP version: 8.1
Magento version: 2.4.6
Klaviyo extension version: 4.0.10
Anything else that would help a developer reproduce the bug?

Steps to reproduce

After upgrade to Magento version 2.4.6 an error on this function :

require(['domReady!'], function()

Expected result

No errors in Google console

Actual result

Error in Google Console: require(['domReady!'], function()

Additional information

No response

@jorgb90
Copy link

jorgb90 commented Mar 21, 2023

Same here. Updated to Magento 2.4.6 and Klaviyo integration stopped working. Reauthorize is working, but still reporting error after it.

Don't know if the issues are related. @jesperbrejning I think this isn't API related or is it?

Update

I found my problem which can be checked here magento/magento2#37278

@jesperbrejning
Copy link
Author

I don't think it's the same error I see, because we don't have special characters in the sku. But we do have special characters in ex. the "Name". Could that cause the error?

script text="text/javascript">
require(['domReady!'], function () {
var _learnq = window._learnq || [];
_learnq.push(['track', 'Viewed Product', {"ProductID":"97679","Name":"Tryk mig p\u00e5 maven - Dyr p\u00e5 g\u00e5rden fra Boldens Forlag","SKU":"9788772053554","URL":"https://www.babygear.dk/tryk-mig-pa-maven-dyr-pa-garden-fra-boldens-forlag.html","Price":"59.00","FinalPrice":"59.00","Categories":["Billedb\u00f8ger","Bestsellers"],"ImageURL":"https://www.babygear.dk/media/catalog/product/cache/44d872830c388882e3e32a2a33f56854/9/7/9788772053554.jpg"}]);
_learnq.push(['trackViewedItem', {"Title":"Tryk mig p\u00e5 maven - Dyr p\u00e5 g\u00e5rden fra Boldens Forlag","ItemId":"97679","Url":"https://www.babygear.dk/tryk-mig-pa-maven-dyr-pa-garden-fra-boldens-forlag.html","Categories":["Billedb\u00f8ger","Bestsellers"],"Metadata":{"Price":"59.00"},"ImageURL":"https://www.babygear.dk/media/catalog/product/cache/44d872830c388882e3e32a2a33f56854/9/7/9788772053554.jpg"}]);
});
</script>

@cykolln
Copy link
Contributor

cykolln commented Apr 7, 2023

@jesperbrejning Can you please specify the error you are seeing on the console? Special characters should not cause issues in onsite tracking.

@jesperbrejning
Copy link
Author

We are seeing this error on all product view pages.

The error in console is the following:

Uncaught ReferenceError: require is not defined
at pixi-serie-bondegardens-dyr-med-sebastian-klein.html:8466:3
(anonym) @ pixi-serie-bondegardens-dyr-med-sebastian-klein.html:8466

With reference to this function in the code:

<script text="text/javascript"> require(['domReady!'], function () { var _learnq = window._learnq || []; _learnq.push(['track', 'Viewed Product', {"ProductID":"68475","Name":"Pixi-bog - Bondeg\u00e5rdens dyr m. Sebastian Klein (1 bog, ass.)","SKU":"9788711698518","URL":"https:\/\/www.babygear.dk\/pixi-serie-bondegardens-dyr-med-sebastian-klein.html","Price":"15.00","FinalPrice":"15.00","Categories":["Pixib\u00f8ger"],"ImageURL":"https:\/\/www.babygear.dk\/media\/catalog\/product\/cache\/44d872830c388882e3e32a2a33f56854\/9\/7\/9788711698518.jpg"}]); _learnq.push(['trackViewedItem', {"Title":"Pixi-bog - Bondeg\u00e5rdens dyr m. Sebastian Klein (1 bog, ass.)","ItemId":"68475","Url":"https:\/\/www.babygear.dk\/pixi-serie-bondegardens-dyr-med-sebastian-klein.html","Categories":["Pixib\u00f8ger"],"Metadata":{"Price":"15.00"},"ImageURL":"https:\/\/www.babygear.dk\/media\/catalog\/product\/cache\/44d872830c388882e3e32a2a33f56854\/9\/7\/9788711698518.jpg"}]); }); </script>

@neha023
Copy link

neha023 commented Sep 20, 2024

@jesperbrejning I am facing the same issue whenever I put my website in production mode it is showing different errors in console like -

http://127.0.0.1/magento24/static/frontend/MageTheme/child/en_US/domReady.js 404 (Not Found)
Refused to execute script from 'http://127.0.0.1/magento24/static/frontend/MageTheme/child/en_US/domReady.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'http://127.0.0.1/magento24/static/frontend/MageTheme/child/en_US/jquery-ui-modules/widget.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

 Refused to execute script from 'http://127.0.0.1/magento24/static/frontend/MageTheme/child/en_US/jquery-ui-modules/core.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Refused to execute script from 'http://127.0.0.1/magento24/static/frontend/MageTheme/child/en_US/mageTranslationDictionary.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

require.js:168 Uncaught Error: Script error for "domReady", needed by: domReady!_unnormalized2, domReady!_unnormalized3
https://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js:168:17)
    at HTMLScriptElement.onScriptError (require.js:1738:36)

We have custom theme them and more than 70 extensions, unable to find the cause what happened, the site was initially in 2.4.5-p2 and we upgraded it to 2.4.6-p3 and these issue we are facing from long time

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

No branches or pull requests

4 participants