Sync smart contracts not triggering and showing in the Database

Yes, when I first set it up, it populated it with 10 rows, which I specified (10) in the “Max Historical Records” Field, so it pulled in those more or less straight away, however since then no more rows of events have been added, despite blockchain events happening.

Try to disable that beforeSave to see if it works

Do you mean the:

Moralis.Cloud.beforeSave(“AuctionCreated”, async (request) =>{

That is in the Cloud functions?

Yes, that one, or you could add more logging

I’ve removed everything from cloud functions, will see if that makes a difference

What would more logging be?

Like a logger.info in the first line of that function

OK, it looks like it updates the database now.

However I have now lost the cloud functions console screen on the “Cloud Functions” tab even though the CLI says: Changes Uploaded Correctly

the server has cloud code now, you say that you don’t see it in admin interface?

no its not there, it used to be:

Ok, we will check why it is not showing now

cloud code works now again

OK great thanks.

Also sorry to keep at this, if beforeSave causes the sync to have issues with updating the data table, as we’ve discovered by removing it:
Moralis.Cloud.beforeSave(“AuctionCreated”, async (request) =>{

Note: this is used in the Moralis tutorial video (time 6:03) and appears to work on there:

What should be used instead?

you should make it work without errors, now it has errors on executions and when beforeSave fails there is no data saved

you can use afterSave as an alternative

Thanks

I’m getting a bunch of
Error: Invalid function: “pluginsReady”
I don’t have any plugins, so i’m not sure what that means:

2022-09-01T20:46:59.132Z - 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)
2022-09-01T20:46:04.029Z - 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)
2022-09-01T19:03:37.699Z - 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)

You will see those errors usually when the server restarts

Thanks for your patience.

I have these errors:

afterSave failed for AuctionCreated for user:
Error: {
“message”: “data is not defined”,
“code”: 141
}

Does that mean I need to add those as columns in the database table?

Can you post your afterSave code? Check your use of data, make sure that variable exists.

I’ve just made a new post, it doesn’t really belong to this one anymore:

Code included in that