[SOLVED] Can't sync smart contract events on local dev chain to moralis database

This topic has been brought up numerous times recently, mainly due to the popularity of Patrick’s excellent course. Perhaps I am going blind but I am still struggling and I feel I am beginning to exhaust my list of potential solutions. “https://1kzqno6bfdou.usemoralis.com:2053/server” is the latest attempt

Things go well to begin with:

  • I create the Dapp, copy the frp files over and update the ini-file.

  • ./frpc.exe -c frpc.ini : successful:
    2022/08/29 23:42:08 [I] [service.go:349] [346c0dfb2d0de363] login to server success, get run id [346c0dfb2d0de363], server udp port [0]
    2022/08/29 23:42:09 [I] [proxy_manager.go:144] [346c0dfb2d0de363] proxy added: [hardhat]
    2022/08/29 23:42:09 [I] [control.go:181] [346c0dfb2d0de363] [hardhat] start proxy success

  • I create a sync script that successfully starts the connection between Moralis and my hardhat instance

  • I create som smart contract syncs that monitor events - - moralis ui: confirms it is syncing 3 smart contracts and moralis database registers EventSyncStatus 3

so far so good, but then things start to go south:

  • I produce transactions with events. The transactions are shown in the blockchain log BUT nothing in the Moralis sync UI page or Database Tables

  • However, activity is registered in the database’s logs:
    2022-08-29T22:11:42.757Z - Ran cloud function coreservices_listEventSyncStatus for user undefined with:
    Input: {}
    Result: {“status”:200,“data”:{“results”:[{“tableName”:“ItemBought”,“createdAt”:“2022-08-29T21:44:52.356Z”,“updatedAt”:“2022-08-29T21:44:52.575Z”,“abi”:"{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:“address”,“name”:“buyer”,“type”:“address”},{“indexed”:true,“internalType”:“address”,“name”:“nftAddress”,“type”:“address”},{“indexed”:true,“internalType”:“uint256”,“name”:“tokenId”,“type”:“uint256”},{“indexed”:false,“internalType”:“uint256”,“name”:“price”,“type”:“uint256”}],“name”:“ItemBought”,“type”:“event”}",“address”:“0x5FbDB2315678afecb367f032d93F642f64180aa3”,“chainId”:“1337”,“filter”:"{}",“sync_historical”:true,“topic”:“ItemBought(address,address,uint256,uint256)”,“sync_historical_until_block”:-1,“id”:“GOGMBBiUvnbVnb3kB6tCIvDC”},{“tableName”:“ItemListed”,“createdAt”:“2022-08-29T21:44:52.727Z”,“updatedAt”:“2022-08-29T21:44:52.791Z”,“abi”:"{“anonymous”:false,“inputs”:[{“indexed”:true,“internalType”:"address… (truncated)

The database creates an error in the log while it is building:
2022-08-29T22:07:20.725Z - Error: Invalid function: “pluginsReady”
at handleCloudFunction (/moralis-server/lib/Routers/FunctionsRouter.js:201:13)
at /moralis-server/lib/PromiseRouter.js:85:20
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Any suggestions to what might work?

1 Like

I’ll have to check with a new server, I’m not sure now what happens on that server

I am facing the same issue.

There was an issue on our side, where syncs were not working, you can try to update the server and it should work after that

Thanks! I will try during the day.

I did upgrade yesterday, without it changing the situation, but will try again.

Will keep you posted

Thanks for informing, just to be sure can you please explain, how to update the server

you update the server from admin interface, in dapps page, you will see a button for your server that will update/restart the server

@cryptokid : created a new new Dapp from scratch and upgraded it. I have emitted 3 events so far and they are all in the database! Looks like it works! Thanks and say thanks to the issue resolution/db team.

@hammadtariq65: fyi

2 Likes

Thanks for the prompt response, works for me too

1 Like

@cryptokid I have this exact issue. I also tried creating a new server from scratch and updating it but didn’t work. Please Help. Only error I can see is

2022-09-07T11:28:47.569Z - Error: Invalid function: “pluginsReady”
at handleCloudFunction (/moralis-server/lib/Routers/FunctionsRouter.js:201:13)
at /moralis-server/lib/PromiseRouter.js:85:20
at processTicksAndRejections (node:internal/process/task_queues:96:5)

what is the server url?

can you try to add the event syncs again? I don’t see them now on your server

sorry I had forgot to run add events scripts after I created new server. I was distracted by Error: Invalid function: “pluginsReady” but Now it’s working after creating a new server from scratch. Sorry for any inconvenience.

1 Like