pim-community-dev icon indicating copy to clipboard operation
pim-community-dev copied to clipboard

Products page error on loadDataGrid. Unexpected end of JSON input

Open qmauret opened this issue 4 years ago • 7 comments

🐛 I'm reporting a Bug 🐛

When i try to access to products listing page, i have a javascript error that makes the page inaccessible.

the error : VM15892:1 Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at child.loadDataGrid (table.js:67) at fire (jquery.js:3291) at Object.fireWith [as resolveWith] (jquery.js:3421) at done (jquery.js:9523) at XMLHttpRequest.<anonymous> (jquery.js:9775)

the function concerned (in table.js line 67) : $("#grid-".concat(gridName)).data({ metadata: resp.metadata, data: JSON.parse(resp.data) });

The problem is that, at this time, resp.data is an empty string. That's why i have got an error. After an investigation, i found that the empty string comes from this call : http://localhost:8080/datagrid/product-grid/load?dataLocale=fr_FR&params%5BdataLocale%5D=fr_FR&product-grid%5B_parameters%5D%5Bview%5D%5Bcolumns%5D=identifier%2Cimage%2Clabel%2Cfamily%2Cenabled%2Ccompleteness%2Ccreated%2Cupdated%2Ccomplete_variant_products%2Csuccess%2C%5Bobject+Object%5D

Maybe it's because of the object param at the end of query. I don't know what's going on here and why do I have an empty string as response while I have products created

I'm using CE version 4.032 through Docker install. I have done several things since install (adding categories, attributes, families, and add product model with two variations) it was working well and then boom 💥

qmauret avatar Jun 16 '20 14:06 qmauret

Oups did not want to close issue 😅 I found something that could be linked to my problem ! When I try to export products I have the error below :

{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [akeneo_pim_product_and_product_model]","resource.type":"index_or_alias","resource.id":"akeneo_pim_product_and_product_model","index_uuid":"_na_","index":"akeneo_pim_product_and_product_model"}],"type":"index_not_found_exception","reason":"no such index [akeneo_pim_product_and_product_model]","resource.type":"index_or_alias","resource.id":"akeneo_pim_product_and_product_model","index_uuid":"_na_","index":"akeneo_pim_product_and_product_model"},"status":404}

qmauret avatar Jun 16 '20 15:06 qmauret

have you found a solution to this?

akosglue avatar Nov 06 '20 12:11 akosglue

Facing the exact same problem, any solution ?

radhikavm avatar Feb 08 '21 23:02 radhikavm

Hey,

you can try to reset the elasticsearch index.

php bin/console akeneo:elasticsearch:reset-indexes --env=prod && \
php bin/console pim:product-model:index --all --env=prod && \
php bin/console pim:product:index --all --env=prod

Flou21 avatar Apr 16 '21 10:04 Flou21

@Flou21 that did the trick for me, thanks a lot!

qzminski avatar Jun 18 '21 10:06 qzminski

still facing the issue after running php bin/console akeneo:elasticsearch:reset-indexes --env=prod &&
php bin/console pim:product-model:index --all --env=prod &&
php bin/console pim:product:index --all --env=prod please help

prakharsaxena2 avatar Aug 09 '21 08:08 prakharsaxena2

Hey,

you can try to reset the elasticsearch index.

php bin/console akeneo:elasticsearch:reset-indexes --env=prod && \
php bin/console pim:product-model:index --all --env=prod && \
php bin/console pim:product:index --all --env=prod

@Flou21, I try this but unfortunatly it's showing same issues.

{"error":{"root_cause":[{"type":"query_shard_exception","reason":"No mapping found for [updated] in order to sort on","index_uuid":"tk-xk1DZTnunk9AWaqgjsA","index":"akeneo_pim_product_and_product_model"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"akeneo_pim_product_and_product_model","node":"ckW_Yf5cR92yebvAXEBAVA","reason":{"type":"query_shard_exception","reason":"No mapping found for [updated] in order to sort on","index_uuid":"tk-xk1DZTnunk9AWaqgjsA","index":"akeneo_pim_product_and_product_model"}}]},"status":400}

rakibulinux avatar Nov 11 '23 02:11 rakibulinux