Magento2: 2.0.9 : customer-data.js:49 Uncaught Error: [object Object]

Created on 31 Aug 2016  Â·  18Comments  Â·  Source: magento/magento2

Issue description

I get the following error in the console. It doesn't matter if I'm logged in or not or if I have any products in my cart:

customer-data.js:49 Uncaught Error: [object Object]

Steps to reproduce

  1. Open Chrome (version 52 at the moment of writing).
  2. Go to a product detail page.
  3. Add to the cart.
  4. Refresh the page.

Watch the console.

Expected result

No error in the console

Actual result

Error in the console:

customer-data.js:49 Uncaught Error: [object Object](anonymous function) 
@ customer-data.js:49 fire 
@ jquery.js:3099 fireWith 
@ jquery.js:3211 done 
@ jquery.js:9312 callback 
@ jquery.js:9720

Additional information

Prior before the error a XHR request throws a 400 error (http://www.domain.com/customer/section/load/?sections=paypal-billing-agreement&update_section_id=false&_=1472630495115). This results a valid JSON object:

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

I think the 400 error status results the exception to be thrown in customer-data.js. I'm not sure if this is an issue with Magento, my PSP (MultisafePay) or the OnePageCheckout module I'm using.

Did anyone else encounter this problem is well?

Edit: _When I disable the PSP and Checkout plugin, the error still persists, which makes sense because it never showed up before._

Edit 2: _When I also disable Magentos' Braintree and Paypal plugin, the error still persists. Which is odd. Also, I noticed that in an incognito window I don't get the error._

Edit 3: _It doesn't happen in incognito mode. For some reason, the 'regular' mode makes an extra XHR request that triggers the error._

Format is not valid

Most helpful comment

GOT IT!

It turns out that customer-data.js uses the localStorage to store a variety of stuff (probably for caching purposes). This means that when a module (or Magento) updates, you'd better make sure to flush your local storage as well, because otherwise you're in a world of debugging-hurt

All 18 comments

@kanduvisla thank you for your report.
Please, format this issue according to the Issue reporting guidelines: with steps to reproduce, actual result and expected result.

It get's weirder:

When I delete all my cookies, I don't get the error. However, as soon as I add a product to the cart and refresh the page afterwards, the error pops up. But even more strange: when I open an incognito window in Chrome, the error doesn't occur!

Further investigation shows that my 'regular' browser (which is Chrome by the way) makes an additional XHR request to http://www.domain.com/customer/section/load/?sections=paypal-billing-agreement&update_section_id=false&_=1472630495115 whereas the incognito window doesn't. What gives?

GOT IT!

It turns out that customer-data.js uses the localStorage to store a variety of stuff (probably for caching purposes). This means that when a module (or Magento) updates, you'd better make sure to flush your local storage as well, because otherwise you're in a world of debugging-hurt

Thanks, flushing cache storage worked for me too.

Hm, god for you it worked, but it doesn't for me. I also get this error in incognito mode. Happens in both incognito and regular browser. Cleared all browsercaching, Magento caching, removed all folders in pub/static, var/di, var/generation, var/view_preprocessed and regenerated it all again but the error remains. Did you notice this in production or in developer mode?

Have there been fixes for this? The localStorage is mashed up hack!

I experience the same issue with Magento 2.1.5 in Developer Mode. Clearing caches does not seem to work, it also happens in incognito mode from Chrome.

+1

Same issue on 2.1.6, how to fix?

This sometimes resolve itself.

I got this issue as well on 2.0.11 using PHP 7.0 and chrome.
Further console logging customer-data.js:49 gives the following error for me:
Warning: array_key_exists() expects parameter 2 to be array, null given in \/var\/www\/alpha\/vendor\/magento\/module-customer\/CustomerData\/Section\/Identifier.php on line 82

Possible fix:
extend this file (Identifier.php) and add this in the foreach loop in the function markSections:
if(!isset($sectionsData[$name])){
$sectionsData[$name] = [];
}

@kanduvisla I can clear my local storage after an upgrade, no problem. But how to tell every customer using the shop to clear his local storage?

You can force delete it in the head and reset it via Magento.

Just do that for few weeks.

Khaleel Mughal

On Mon, 7 May 2018, 2:06 pm Bernhard Poiss, notifications@github.com
wrote:

@kanduvisla https://github.com/kanduvisla I can clear my local storage
after an upgrade, no problem. But how to tell every customer using the shop
to clear his local storage?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/6410#issuecomment-387019818,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAVsCPza4QII_GEARoXjBHO2x5_1snuSks5twByvgaJpZM4JxVt7
.

@magento-engcom-team Just ran into this problem on 2.2.7. any solutions?

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

Preconditions:

Magento 2.2.7

Steps to Reproduce:

  1. Upgrade from 2.2.6 or earlier to 2.2.7
  2. Clear all caches, di, static content
  3. Navigate to a product page on the frontend
  4. Attempt to add product to cart

Expected Result:
Product added to cart successfully

Actual result
It attempts to add product, but completes with no success message and a javascript endless spinning wheel appears. Error in js console Uncaught Error: [object Object]
at Object. (customer-data.js:91)
at fire (jquery.js:3232)
at Object.fireWith [as rejectWith] (jquery.js:3362)
at done (jquery.js:9842)
at XMLHttpRequest.callback (jquery.js:10311)

HI @Ctucker9233 thank you for you report, this issue has already fixed in 2.3-develop and 2.2-develop branch and will be available on 2.3.1 release

Was this page helpful?
0 / 5 - 0 ratings