Watch Address from front-end code

Im trying to sync an address from my front-end, I dont get any errors but they are not getting saved or synced either.

my cloudfunctions.js file

Moralis.Cloud.define("syncAddress",async (request)=>{
    return await"watchEthAddress", {address:request.params.address},{useMasterKey:true});

my front-end code

 async syncAddress() {
      try {
        await"syncAddress", { address: this.address }, {useMasterKey:true});
        this.address = "";
      } catch (error) {

do you have a nitro server?
did you try to restart/update the server?

in front end you don’t need to use master key, only in cloud code

what do you get as response?

I dont get anything as a response, but as far as I know the watchEthAddress function doesnt return anything either right?

I think it started working now after server upgrades, but the addresses to watch keep beeing stuck in the addressSyncStatus collection although they dont hold many entries.

You can also paste the server url here.

I would expect it to work and to return some message if it worked or not.

What do you mean by

server url

When I call this function

Moralis.Cloud.define("syncAddress",async (request)=>{
    const address = request.params.address.toLowerCase();
    if(!address) return;
    return await"watchEthAddress", {address}, {useMasterKey:true});

the addresses passed into that function end up stuck in the collection from the image above.

I can look later at the server. What you mean by being stuck in that collection?

that the addresses remain in that table with no transactions etc beeing synced. They should not be left in that collection but rather start syncing the transactions and balances etc.In my case they only get inserted into the table above and thats it.

the server error logs also show this

2022-03-17T16:46:27.217Z - Error: Invalid function: "pluginsReady"
    at handleCloudFunction (/moralis-server/lib/Routers/FunctionsRouter.js:126:13)
    at /moralis-server/lib/PromiseRouter.js:85:20
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Ok, it shouldn’t work like that.

Are you sure the server is on the same eve network where those transactions are made?

yes server is on mainnnet and transactions too

deleted all rows from db collections, rebooted server, ran my cloud function again log shows this output but still, nothing gets synced.Im on a paid subscription too.

the error log shows nothing, the info log shows this

2022-03-17T18:21:05.668Z - Ran cloud function syncAddress for user 8fO5QXSzNdSci03Yx34q5pK9 with:
  Input: {"address":"0x7edD7d8Bb062c9883400E498CB7538A008281468"}
  Result: {"status":200,"data":{"success":true,"result":true}}
2022-03-17T18:21:05.661Z - Ran cloud function watchEthAddress for user undefined with:
  Input: {"address":"0x7edd7d8bb062c9883400e498cb7538a008281468"}
  Result: {"status":200,"data":{"success":true,"result":true}}
2022-03-17T18:21:05.656Z - Ran cloud function coreservices_addAddressSync for user undefined with:
  Input: {"chainId":"0x1","address":"0x7edd7d8bb062c9883400e498cb7538a008281468"}
  Result: {"status":200,"data":{"success":true,"result":true}}

nothing gets synced, _AddressSyncStatus hold 1 document (the address I am trying to sync"

Ok, this should be easy. I can look in an hour.

1 Like

ty keep me posted , appreciate it

you may need to set historical sync to true if you want to see historical data synced

1 Like

please dont let this be the error lol

okay, so using sync historical I get data populated into the tables, but what is still weird is that the table (collection) “watchedEthAddresses” is empty? Can you check on this server please, something seems messed up. Its also adding way more tokens, transaction etc than the wallets actually ever performed or held.

I don’t see a problem, the server seems to have the transactions specified to those 3 addresses that are added to watch

Its more than they have, and also the table watchedEthAddress is empty, although it was syncing transaction data. Normally, the addresses we enter for sync should appear in the table watchXXAddress. In my case they are not.

we changed how that works in latest updates, now the information about the addresses is in _AddressSyncStatus

1 Like

oh my bad, didnt see that information anywhere. Can you link me towards the changelogs? Its confusing because the collection watchedEthAddress still is shown in the dashboard. Also NFT and Token holdings collection doesnt exist.