5

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.

  • First, check what inside the Object jqXHR. The construct method of the Error class expected the string message (or Object with toString method). – Siarhey Uchukhlebau Nov 15 '17 at 14:14
  • @SiarheyUchukhlebau I edited the question with the jqXHR contents. – Lez Nov 15 '17 at 15:03
  • where did you find the jqXHR Oject? – krybbio Mar 26 '18 at 17:37
  • @krybbio You can see it while debugging on line 90 of the customer-data.js file. You can also see it in your browser debugger on the network tab (name depends on browser) --> you will see a "400 error code - bad request" and inside the request you will see the request url and response message. – Lez Mar 26 '18 at 17:50
28

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

  • 4
    How to fix this for all users of the shop? I can see that many users see this error in new relic and I guess they won't clear their local storage (but they likely just leave the page). – bpoiss Apr 30 '18 at 5:45
  • Thank you for this answer - it saved me many hours :) – artwoz Dec 4 '18 at 9:58
  • I too got this error, it turned out it was caused by headers already sent error by another module. It helps to add a console.log(jqXHR) just before the error is thrown. See also magento.stackexchange.com/questions/198333/… at the bottom – Isolde Dec 7 '18 at 14:36
  • I tried all things those u said but same issue. screencast.com/t/XEueQ00Foqs3 – Pratik Mehta Dec 31 '18 at 9:36
  • thankfully found this before spending many hours, I had tried to invalidate wrongly named section at some point, and this was cached. – Joel Davey Feb 13 at 10:41
1

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.

  • 1
    Seems I has the Paypal module disabled in app/etc/config.php but it wasn't disabled "in the right" way so it caused this issue. Thank you for the suggestions! – Lez Nov 16 '17 at 12:42
  • @Lez I'm glad to help you – Siarhey Uchukhlebau Nov 16 '17 at 12:43
0

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.

0

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 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.