Transaction confirmation stuck on 'undefined'


I have a plugin that is triggered by a smart contract event. When triggered, the event is registered as a transaction in the database. I then use Cloud Function check to see if transaction is confirmed and migrate all confirmed transactions to another table.

I asked my community to try to break the app, and someone used a bot to spam attack the smart contract. Moralis confirmed the first few, but then skipped a large chunk of the subsequent transactions. Cloud function logic is never executed because transaction is not labeled as confirmed.

Any idea what happened here?

moralis server:
table: bscNFTEditionsClaimed

Hey @cosmos, hope you are well.

Could you please share the plugin code? would be great to check if you are using any timeout for each iteration request. :face_with_monocle:

READ BEFORE POSTING - How to post code in the forum

Carlos Z

Thank you for your response @thecil.

My plugin code only include abi and address info. I think you are referring to my cloud function. I do not have a timeout for each iteration.

Plugin Code:

  "anonymous": false,
  "inputs": [
      "indexed": false,
      "internalType": "bytes",
      "name": "id",
      "type": "bytes"
      "indexed": false,
      "internalType": "uint256",
      "name": "edition",
      "type": "uint256"
      "indexed": false,
      "internalType": "address",
      "name": "staker",
      "type": "address"
      "indexed": false,
      "internalType": "uint256",
      "name": "timeLocked",
      "type": "uint256"
  "name": "NFTEditionClaimed",
  "type": "event"

Set to trigger on address:


and topic:


Cloud Function to be triggered after plugin has saved transaction. Will only execute logic if transaction confirmation is labelled as ‘True’.

Moralis.Cloud.afterSave("bscNFTEditionsClaimed", async (request) => {
  if (request.object.get("confirmed") == true) {
    const NewPool = Moralis.Object.extend("AllNFTEditionsClaimed");
    const newPool = new NewPool();
    newPool.set("network", 97);
    newPool.set("block_hash", request.object.get("block_hash"));
    newPool.set("block_timestamp", request.object.get("block_timestamp"));
    newPool.set("transaction_hash", request.object.get("transaction_hash"));
    newPool.set("staker", request.object.get("staker"));
    newPool.set("timeLocked", request.object.get("timeLocked"));
    newPool.set("address", request.object.get("address"));
    newPool.set("uid", request.object.get("uid"));
    newPool.set("edition", request.object.get("edition"));
    newPool.set("block_number", request.object.get("block_number"));
    newPool.set("createdAt", request.object.get("createdAt"));;
    const ExistingPool = Moralis.Object.extend("AllNFTPools");
    const query = new Moralis.Query(ExistingPool);
    query.equalTo("uid", request.object.get("uid"));
    query.equalTo("address", request.object.get("address"));
    const pool = await query.first();
    const newRemaining = (parseInt(pool.get("remaining")) - 1).toString();
    pool.set("remaining", newRemaining);;

Should I include a timeout in the cloud function?

It seems the error is happening with the plugin since the transaction confirmation is never set to ‘true’. If I manually set the transaction confirmations to true, the cloud function performs as expected.

From what I understand you say that first transactions from bscNFTEditionsClaimed table were confirmed and the following ones were not confirmed. Do you know if those following transactions that are unconfirmed are really valid transactions?

You could also run a separate script that checks if transactions are confirmed.

A python example:

import requests

post_data = '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xf10d04c6ea144fe60347c5bea2cb6aa32db8bc39e6d14ff051a84225af513178"],"id":1}'
speedy_node = '<!!!!!!your_id_here>/bsc/mainnet/archive'

headers = {
    "Content-Type": "application/json"
statusResponse = requests.request("POST", speedy_node, headers=headers, data=post_data)

data = statusResponse.json()
print("result=", data['result']['status'])

Hello thank you for your response.

Yes here is screen shot from bscNFTEditions where the transactions stopped confirming.

Yes the transactions were confirmed successfully.

Furthermore, there were a total of 11 transactions that did not even make it to the table but were submitted successfully as seen on BSCScan. (The highlighted transactions were synced to bscNFTEditionsClaimed, the rest were skipped.)

So they should have been synced and confirmed on Moralis, correct? It almost looks like server went down for a quick minute and didn’t sync transactions when it was offline.

Not sure if it helps, you should upgrade to latest Moralis server in case that you have an older version.

Thanks I will try. For reference I was on v0.0.248. I am updating now to v0.0.249 which doesn’t have change log at the moment so I am not sure what it is updating.

I have v0.0.250 after I updated today.