[SOLVED] afterSave Trigger not firing when cloud code updates

Hello,

Iโ€™m syncing database events from multiple contracts and then merging them into one table with afterSave triggers (also checking confirmed to prevent duplicates)

but when I update cloud codes there are duplicates or missing entries on the merged table

I guess this can be solved using Seamless Updates mentioned in the docs; but I couldnt find how to enable it. There is no such option on server settings.

is there anything else to do other than seamless updates to prevent this?

server url: https://t4aq8pznabcw.usemoralis.com:2053/server

Thanks

In particular it looks like this server has seamless updates enabled and it is not a nitro server with coreservices plugin installed.

Can you try to test that with a new created server that will be a nitro server?

you can also try to use a job that runs every x minutes instead of afterSave hook

thanks will try that

if I create a new server, is it nitro server by default? event with a free account?

yes, any new created server is a nitro server now

just for information:

I guess moralis-cli is not supporting syncing events on nitro servers yet?

Moralis Admin CLI Version: 2.1.16

it doesnt show any of the available providers, I have to do it from admin.moralis.io, sync tab


Do you need to sync historical events? (y/n): y

The following providers are avaiable:

@cryptokid Iโ€™m having a bug when syncing from different networks

I created a new server, selected Polygon Mainnet and BSC Mainnet
server url: https://aishsx8zeop6.usemoralis.com:2053/server

then I sync one event on BSC, it sync correctly to the table BetBNB
then I sync same event from a contract on Polygon, it syncs correctly to the table BetMatic

but polygon events also sync into BetBNB as well, now BetBNB has both bsc events and polygon events

which of course breaks the system

I mean I will eventually sync all these tables into one using afterSave triggers; but I donโ€™t think this is the intended behaviour

Can you please check this?

note: this was not happening pre-nitro servers

edit: just incase anyone else have the same difficult until this is fixed; Iโ€™m using the new filter option to filter the address for specific class

1 Like

we think that we fixed this problem with the latest update or coresrevices plugin, can you try again after you update?

now you can watch a contract event directly from code, without the CLI: https://docs.moralis.io/moralis-server/automatic-transaction-sync/smart-contract-events#watching-from-code

1 Like

Thanks Iโ€™m trying it

actually I created a new sync but no events from history are synced to it

is possible to check this? class names are BetBNBft and BetBNBf

is there a class or event sync limit? because I created quite a lot before this

can you try to update the server? I donโ€™t think that it is because of a limit

thank you it started syncing after the update

1 Like