Debug: customer-data.js:86 Uncaught Error: [object Object] in Magento 2
Ever faced an error that says “customer-data.js:86 Uncaught Error: [object Object]” in Magento 2?
The error text is not as descriptive for the developers to understand the issue and hence leaves them hanging and wondering what to do.
The certified Magento developers at Meetanshi have found the solution mentioned below, for this JS error that is displayed in the console.
When a customer logs in in Magento 2 stores, the customer information is fetched to display on the frontend at My Account, My Wishlist, Checkout page, and other pages.
“Customer-data.js:86 Uncaught Error:[object-object]” error occurs when there is a failure of fetching information. The majority of the time, this error is caused by JavaScript.
Many times, it is being observed, the error occurs due to disabling a module in the wrong way, for example, a payment module.
When this error occurs, the customer details are not displayed in the frontend, or the mini cart is not updated correctly.
To avoid such disruptions, check the below debugging steps for customer-data.js:86 Uncaught Error: [object Object] in Magento 2.
Debugging Steps for customer-data.js:86 Uncaught Error: [object Object] in Magento 2:
You just need to add a console.log to the given path.
pub/static/version…/frontend/[theme package/language_code/Magento_Customer/js/customer-data.js to show the jqXHR error:
Add this code:
1 2 3 4 5 6 7 |
return $.getJSON(options.sectionLoadUrl, parameters).fail(function (jqXHR) { console.log(jqXHR); throw new Error(jqXHR); }); |
With these steps, you will find the error and its place where you need to make changes. Follow the output of console log and solve the error “customer-data.js:86 Uncaught Error: [object Object]” in Magento 2.
If you have a question regarding this error and its solution, feel free to ask in the Comment section below.
I would be happy to help you.
Do share the debugging steps with Magento 2 developers via social media.
Thank you.
Jignesh Parmar
An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.
2 Comments
After printing result in console we are getting status 200 and product get add in cart( can be seen when you directly hit checkout/cart)
but its not reflecting in mini cart and giving this uncaught error.
Hello Rohit,
Please check the error log from there you can easily identify the error cause.
Thank You