Question

I'm using Magento 2.2 with Porto theme and getting an [object Object] javascript error at customer-data.js line 90 in the console after logging into the store and refreshing the page or switching to another page.

I tested this in Firefox, Chrome, IE 11 and Edge and it's only showing up in Firefox (the browser I mostly use).

It isn't causing any serious problems (not as far as I can see), but I would like to resolve this issue.

object Object error

line where the error happens

Line 90 of the customer-data.js file is: "throw new Error(jqXHR);".

Inside the jqXHR object is a JSON response message:

{"message":"\"paypal-billing-agreement\" section source is not supported"}

I've seen a couple of suggestions out there, but most of them revolved around cleaning cache and static files.

I tried: clearing firefox cache and cookies, cleaning Magento static files, cache and storage cache, but nothing worked so far...

And i'm not really sure what else to do...any help would be appreciated.

Edit/Solution

The cause of the error was that I had disabled the Paypal module but didn't clear the browser local/storage cache.

Inside this cache was a certain call to the paypal module which couldn't be processed so it returned a JS error like this.

Clearing this cache fixed the issue.

Was it helpful?

Solution

I have literally wasted a few days trying to debug this issue and finally got a definite solution or work around I would call it. Hopefully it can save a few other people the headache I currently have!

I first noticed this error appears when I switch from Client-Side to Server-Side Compilation in Stores->Configuration->Advanced->Developer->Frontend Development Workflow

Then I determined that customer-data.js uses the localStorage within the browser itself to store a variety of information, so you can clear the Magento Cache all you want and you will still have issues.

TLDR:

The fix in Google Chrome is hit F12 to open the Developer Toolbar, then select the Application tab. Clear the Local Storage, Session Storage, and Cookies. Reload the page and all should be well. You will have to do this on your admin page as well.

Credit: https://github.com/magento/magento2/issues/6410#issuecomment-243704461

OTHER TIPS

This error says that source data is not specified in the sectionSourceMap located at the Magento\Customer\CustomerData\SectionPool class. The paypal-billing-agreement data is defined in the file vendor/magento/module-paypal/etc/frontend/di.xml:

<type name="Magento\Customer\CustomerData\SectionPool">
    <arguments>
        <argument name="sectionSourceMap" xsi:type="array">
            <item name="paypal-billing-agreement" xsi:type="string">Magento\Paypal\CustomerData\BillingAgreement</item>
        </argument>
    </arguments>
</type>

So, probably the paypal module was disabled in the store or some third-party module has disabling it in the not-a-right-way.

To debug that problem open the file vendor/magento/module-customer/CustomerData/SectionPool.php and check what sections is loading in the getSectionsData method. Additionally, you can try to call the method getSectionsData(['paypal-billing-agreement']) somewhere from a custom code, and check step-by-step why this data is not loading.

For me I could see the issue had something to do with the item I had just added to the cart.

enter image description here

So I ran the following query on the DB to remove all quote items from my user account:

DELETE FROM quote WHERE customer_email = 'my.user.email@example.com';

After that the issue went away :)

Please delete records of "Porto Theme" entries from "theme" table. The records will auto create again. And reassign Websites with this Porto theme again and check.

After transfer of data from live server to the dev server, the cookies (dev-server, pre-transfer!) were still stored in the browser. After cleaning of the cookies, everything is fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top