Moralis SDK is failing on event sync and live queries suddenly

Hi,

I am using the Moralis Event syncs and Live queries in the backend server, and the Moralis SDK was properly worked on yesterday. Still, suddenly the SDK failed to add event sync and live query subscription. I need immediate assistance on this, thanks in advance

Moralis SDK: “moralis”: “^1.10.1”
Server Side Framework: Nest.js
Platform: Mac M1

Error Message:
/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/moralis-v1/lib/node/RESTController.js:430
error = new _ParseError.default(_ParseError.default.CONNECTION_FAILED, XMLHttpRequest failed: ${JSON.stringify(message)});
^
Error: XMLHttpRequest failed: {“UNSENT”:0,“OPENED”:1,“HEADERS_RECEIVED”:2,“LOADING”:3,“DONE”:4,“readyState”:4,“responseText”:"",“responseXML”:"",“status”:522,“statusText”:null,“withCredentials”:false}
at handleError (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/moralis-v1/lib/node/RESTController.js:430:15)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Function.initPlugins (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/moralis-v1/lib/node/MoralisWeb3.js:441:40)
at Function.start (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/node_modules/moralis-v1/lib/node/Parse.js:165:7)
at MoralisService.initializeMoralis (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/dist/apps/scheduler/main.js:10453:9)
at SmartContractModule.init (/Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/dist/apps/scheduler/main.js:10610:9)
at /Users/venkateshrajendran/Documents/Work/OP Games/oparcade-backend/dist/apps/scheduler/main.js:10606:13

What is the server url?
Is the server still working?

You can try streams API that is specific to that: moralis.io/streams

Moralis Streams is a new feature, It is going to be live in October and currently, it is in beta. We will migrate to the streams later.

This is the Server URL: https://xzhrsct28lss.usemoralis.com:2053/server
And yes server is working properly, I have verified it via moralis admin dashboard

But still there is an error which doesn’t have any descriptive error message. But this seems working yesterday.

The Moralis Dapp server URL mentioned above was giving an connection timeout error when I try to open that URL

I am restarting the server now, somehow it was using 100% CPU

Can we get some logs on which resource caused the 100% CPU utilization ?

When I was checking the dashboard, the CPU utilization is appeared normal. Do we have any other options such as auto scaling to prevent the server down issues when the CPUs are 100% utilized ? The server connection timeout issues are not good for the mainnet.

I don’t know what happened with that 100% CPU, I only force restarted the server

Thanks for the quick help.

BTW Can’t we get the logs from Moralis internal servers for such spikes in the CPU utilisation ? Without any logs how can we determine the potential root cause ?

Will it be the same case for the servers with Mainnet ?

better to move to self hosting where you have more control

we don’t have internal logs for CPU utilisation

Thanks will look into it and get back here if I have any further questions.

BTW don’t we have auto scaling option to increase the number of server instance when such cases occurs ?

there isn’t autoscaling in place, we can upgrade the server on request

Okay I will get back to you regarding the server upgrade option after internal discussion with my team.

Increasing/upgrading the servers will cost us extra ? Is there any info about this pricing ?

yes, there are separate costs for server upgrades, first server upgrade now is $269/month

Okay got it.

As I can see in the docs, the self-hosted servers don’t support real-time blockchain data sync to the database. I think I cannot use the self-hosted servers until the support for the real-time data is enabled.

I have other doubts, if we use the self-hosted server and when you guys include any new features/bug fixes to the Moralis build, do we need to update the server code with your git repo?

For real time event sync in your backend there is streams API now: moralis.io/streams

We don’t know exactly how it will work for updates. The server is a modified version of parse server

Streams are not production ready, and yes we will migrate to it later.

The server is a modified version of parse server you mean the parse server and streams are going to be different ?

They are different now. They could also be used together in the future.

Do the Moralis team going to release separate support/documentation for the streams server (self-hosted server ) apart from the parse server?

I guess it is better to take a decision about the streams API after the production-ready release.

I have the last two questions for you

  1. If there is any 100% CPU utilization and due to that the servers are down/facing a connection timeout issue, the server should be automatically become active right? / Or do we need to request the support team every time to manually restart ? since the downtime for servers are not good for the production applications.
  2. If there is any 100% CPU/Ram/Disk utilization, do we have any alert system to notify the developers?

in this rare case you will have to contact us, you can also upgrade the server to a better configuration if you want

there isn’t something to notify the developers now, you could try to check the server every few minutes for example by making a request to see if it works

As you said first server upgrade now is $269/month

What are the resources will be upgraded in terms of infrastructure/server? if I wanted to upgrade to the higher one?