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

Cannot read property 'sectionLoadUrl' of undefined #56

Open
mvenghaus opened this issue Mar 28, 2019 · 5 comments
Open

Cannot read property 'sectionLoadUrl' of undefined #56

mvenghaus opened this issue Mar 28, 2019 · 5 comments

Comments

@mvenghaus
Copy link

Hey,

very nice tool .. real time saver!

Magento: 2.3.1

With the automatic generation I have 2 files that won't work. I think they are loaded to early. I removed them via empty .. then it works.

"Magento_Checkout/js/model/totals": "empty:",
"Magento_Checkout/js/view/minicart": "empty:"

Would be nice if you can integrate a solution.

Regards
Marcus

@DrewML
Copy link
Contributor

DrewML commented Mar 28, 2019

Do you have a staging/QA server you can deploy this to so I could take a look? Without stack traces it's hard to know what's going on

@mvenghaus
Copy link
Author

We have no public staging server :(

Do you have include minicart in your build.js?

The problem is that the script cannot access the data provided in the html.

"*":{"Magento_Customer\/js\/customer-data":{"sectionLoadUrl":"https:\/\/www.beutellos.de\/customer\/section\/load\/","expirableSectionLifetime":60,"expirableSectionNames":["cart","persistent"],"cookieLifeTime":"1209600","updateSessionUrl":"https:\/\/www.beutellos.de\/customer\/account\/updateSession\/"}}}

The sectionLoadUrl is not availaible when the minicart is loaded using the bundle.

@DrewML
Copy link
Contributor

DrewML commented Mar 29, 2019

Do you have the bundled Paypal modules included (login/payment)? I believe there was a bug in there that I reported to them. If yes, I can dig up what the fix was.

Was a place where require('someDep') was used instead of define(['somedep'), function(someDep) {} at the top-level, which caused a race in some of the customer-data stuff due to the change in module initialization order.

@julian-van-drielen
Copy link

Ran into this issue on Magento 2.3.1, worked fine on 2.3.0.

Magento_Checkout/js/view/summary seems to be initiated before the customer-data constructor function is called.
No issues with minicart on my end, also Magento_PayPal module is disabled and generated a new build.js.

Any thoughts @DrewML?

@rvr31
Copy link

rvr31 commented May 9, 2019

The issue comes due to that sectionLoadUrl is loaded through x-mage-init. Because of bundles that is not loaded at the time the init functions that do things with customerData are fired. Resulting in this error.

We probably need to think of a way of getting customerData ready earlier or not using it in init functions cause they can be called before the x-mage-init is called.

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