[NEW] Moralis live query and database query is not working properly

We are facing this issue again moralis-live-query-and-database-query-is-not-working-properly

Why can’t we re-open the ticket? Replies are not allowed.

Moralis version - V1
Server - Moralis Hosted Server

We are using Moralis Queries and Live Queries for our event listeners infra where Live queries will emit the events which are used to process the event from the database. In case of failures, we use corn job to fetch the events using Moralis Queries and process them.

The state field in the screenshot is used to determine the state of the event

  1. Emtpy string / Undefined - untouched events yet to be processed
  2. Consumed - Processed events
  3. Failed - Failed Events

Before restarting our BE server:

After restarting our BE server which re-initiates the Moralis instance

Sometimes the Moralis Live queries are not emitting the event and also these events are not being fetched from Moralis queries to process the events. At the moment, if we re-initiate the Moralis by restarting the backend server, everything works properly.

Really don’t know why Moralis is not broadcasting the changes via Live query

Need your support on this ASAP

the live query functionality is from parse server, you are using live queries in your backend?
you could also connect directly to the database from your backend if that could help

are you planning to move to self hosted parse server?

We are using Live queries to listen to the changes which occur on MongoDB. It is working properly but sometimes it is getting stuck as I mentioned above

If I use MongoDB directly in my backend, I need to handle all the MongoDB change streams and queries, etc. it might take time to migrate from the existing implementations. It would be great if you can find this bug and fix it from your side.

We are migrating towards Streams API. Meanwhile, we need our existing infra/implementations to work properly

how often it happens to stop working?

For the past 1.5 months, we have faced this issue 4 times so far

is there an easy way to find out when it happens?

if you could do that maybe you could restart the backend at that time

No, it is not happening always. At some random time, it is getting stuck. It is hard for us to monitor this issue and restart the server because nothing is going to break just the system will be stuck until we restart. hence it is hard to track

Could you make a separate scripts that adds a row in the database every minute and check it if you get it with the live query on the main system?

It should be working but I will try to check this case once.