MongoServerError when deleting objects and DevTools crashed

I’m receiving an error in the console window when trying to delete all objects in a data source. I’ve retried the action multiple times but am getting the same error (see screenshot below). It’s only 110 objects in my data source. The action itself is straightforward; opening a confirm dialog, and if confirmed, then deleting all in the data source. How can I resolve this error?

Also, the Appfarm DevTools seems to crash after the MongoServerError appears. Trying to run the appfarmDebug command in the console prompts me with ‘undefined’ and a ‘TypeError’. I’m able to get it back with a refresh of the app but it disappears/crashes as soon as the delete action fails


can you share what the action node looks like? It seems the MongoDB transaction is failing, because another operation was likely modifying the data while attempting to delete.

Hi Greg,
See the screenshot of the action nodes below. The action itself fires when a button is pressed so there are no pre- or post-actions running.

Below is a screenshot of the logs from when the action is called.

The objects we’re trying to delete contains properties with references to enumerated types. Some of the type values have been deleted (deliberately) but are still held as a reference in the object, showing the value and not the name. Is this a problem when trying to delete the object?

As a workaround, I solved the issue by deleting the first object in the data source while the data source ‘Is not Empty’. It might not be the most optimal way of deleting all objects, but at least it ran without any errors :slight_smile:

Hi, i also got this error yesterday at 16:20 in 4Service

Have never had it before and curious as to what condition gives this conflict :slight_smile:

This was in staging while manipulating some production data

Still looking into this

@Sondre is it possible you have multiple scheduled services running on the same set of data? How were you performing these updates?

@Kaspar I’d like to reproduce this issue locally, in order to find a solution to this, but I can’t manage to do that.

Is it possible to:

  1. get the solution back to reproducing the issue
  2. share with me exactly how the data model is setup and what modifications you’ve made to the enum types?

If the data is sensitive, is it possible to create a minimal scenario for me with screenshots – with non-sensitive data? Basically a basic test case that I can try to reproduce locally so I can dig into this further.

I do understand this is a lot to ask, but I can’t think of another way to simplify debugging.

That is possible. But they can funcionally be run at the same time as they dont use/change the same attributes. So if 2 sources updating the same dataset gives this error that is most likely the case. However if i have made a mistake and they for some reason update the same attribute in the same datasource from 2 different sources at the same time that would be nice to know😊

In this case its just read and a logg datetime for when it was run.

Hi @greg,
I’ve been trying to reproduce this error in multiple ways but without luck. After my temporary fix (iterating over all objects and deleting them one by one) the ‘delete all’ action works as intended so my guess is that I had some old objects that were missing some properties or had references to enum types that no longer exist.
I’ve been modifying the object class properties and enum type values during development, so I believe this has been playing a role in producing the write conflict error although not sure how or why. It’s also strange why the write conflict error appeared when running delete all but not when deleting one object at a time.

Below is the setup of the data model where ‘Class A’ represents the data source that the ‘delete all’ action tried to execute on.

If I encounter this issue again, I’ll try to remember to take some screenshots of the data/objects and give you a heads up :slightly_smiling_face:

Thanks so much for the detailed response. I’ll try to see if I can reproduce this!

1 Like

Hey everyone
we have the same error message here. we’re in production since a couple of days now. but we had , espacially today, a good number of this error. our app is receiving calls from 39 different Kiosque in 18 Point of sales. so specially at lunch. we can receive a huge amount of calls. here are some exemple of this error ( we created a log system to have a sufficient monitoring on each call )

  • Sales synchronisation is to synchronize sales on appfarm ( most of the time it’s only one sale, but can be multiple if there is no connection in those kiosque for a period of time )
  • Bucket Handler is a bucket list that contains sales that are in “wait mod” and not completed. this bucket is shared between every kiosque in the same point of sales.

they both work on the sales datasource, but not playing with the same object. one is only creating, the other one is deleting existing stuff.

hope i was clear.

thanks again :smiley:

Sorry, I didn’t see this message until today!

When each POS terminal calls in (is this via a service?), are they manipulating the same data model?

Hello Greg

Yes they’re calling to a service "Synchronisation - Sales ". I just update a value in their sales and i persist it. They all manipulating the same table “sales Header” and “Sales Line”.

I think in that specific moment, our services just had a kind of “lag” situation for at least 30 minutes. They answering very late ( in normal cases it takes about 2-3 seconds to reply. In that case it took sometime more than 10 seconds )

They also delete via another service "Bucket List - Delete " some sales that are in a waiting list. Those sales are not called in "Sales - Synchronisation "