3

For some unknown reason, during the checkout flow a global message error appears saying Item no longer valid (was removed) - Object no longer valid

when we check its the item is a cart entry which is no longer valid

we found a similar issue raised in git hub. Below is the GitHub issue link,

https://github.com/SAP/spartacus/issues/5596

We wanted to know if any solution was discovered for this issue

We have below versions,

Hybris - 1905.7 Spartacus - 1.4.4

user1606761
  • 105
  • 11
  • most likely this happens when e.g. you've stored an entry model into local variable, then modify it or try to fetch some attribute from it etc, but in the meantime another thread already removed it – Andrii Andriichuk May 20 '21 at 14:46

2 Answers2

0

This is a known case with multi-dimensional products.

Generic variant product is dependent upon the Product as a partOf attribute. But in some scenarios when the GenericVariant product instance is modified without modifying the base product then sync deems that genericvariant instance as an orphaned one that should not be related to the product so it deletes the variant and recreates one.

Now in the checkout, the PK of the entry changes as the sync has created a new Online variant due to the above reason. Since the cart contains the entry of the earlier variant with another PK which could not be found, the error of "Object No Longer Valid" is thrown.

This is not traceable as the same product is available in the cart entry (but with a different PK)

The below approach of modifying the sync description through Backoffice-> System -> Multithreaded Synchronization should help to resolve this.

In the below screen, I have disabled sync of Product Variants [Variants] (The selected node). By default, it is ticked.

Resolution Image

CX Jira References:

  1. https://cxjira.sap.com/browse/ECP-3394
  2. https://cxjira.sap.com/browse/ECP-5494
Vikrant
  • 1,809
  • 1
  • 13
  • 18
0

I believe this is also related or very similar to the backend, which throws the error type 'JaloObjectNoLongerValidError'

For Spartacus release 5.0, which should be coming somewhere in March 2022, we have fixed this issue by creating a backoff mechanism, which retries the request when the error is thrown.

An example of it's usage can be found in here.

Moreover, you can see the mechanism in action from this end to end test.

BrianGJ
  • 166
  • 3