[SOLVED] watchEthAddress not registering event

Hi there,

We use Moralis to monitor eth transactions but recently the “watchEthAddress” API seems to have stopped working.

I’ve got a reproducible snippet which should add an address to the _AddressSyncStatus table but no entry is added after successful invocation.

Please see example below:

import Moralis from 'moralis-v1/node';

Moralis.start({
  serverUrl: 'REDACTED!!!',
  masterKey: 'REDACTED!!!',
  appId: 'REDACTED!!!',
}).then(() => {
  const address = '0xba62710cd36b5f801f9717af89055eccaf261045';

  Moralis.Cloud.run(
    'watchEthAddress',
    {
      address,
      sync_historical: true,
    },
    { useMasterKey: true }
  )
    .then(() => console.log('did it'))
    .catch(e => console.error(e));
});

Running the above prints “did it” which indicates a successful call:

markoorn@Marks-MBP monorepo % npx ts-node ./moralisTest.ts
did it

But looking at the _AddressSyncStatus table there is no corresponding entry for address ‘0xba62710cd36b5f801f9717af89055eccaf261045’ (see attached screenshot)

Can you please assist?

Can you also paste the server url?

Did you try to use streams api?

Sure, the serverUrl is: https://ibcp6nqeywm8.usemoralis.com:2053/server

I have not yet tried the streams api, this is a live system which is currently in production so I’m hesitant to swap over to the streams api when this was previously working.

If I can’t resolve it as is then I will have to though.

this address already existed in redis, now it also in that table after I restarted coreservices (you can restart coreservices programmatically if needed, you will find in other forum posts how to do it)

Great thank you, how can I see it in Redis to verify if this happens again?

Also, do we have any idea why this happened or how to prevent it in future? It’s quite a problem when this happens in production so would like to try figure out a longterm solution if possible.

Also, would moving to the streams api be more stable and potentially bypass the restarting issue?

yes, using streams will be more stable, it will be a different mechanism, you will receive a webhook request with new transactions/events

streams API works now only for future transactions/events

you can connect directly to redis from cloud code if you want to do that, you can try to restart coreservices in case that something similar happens in the future

Great, thank you for your assistance, I’ll make the switch to streams then.