I configured Sync and Watch contract event to my contract and i set function in Cloud Function to call our serverâs API.
It worked but sometimes it do not call API to our server although i saw new record in collection tables.
what is the code that you used for the cloud function? was a specific trigger?
I am using Moralis.Cloud.afterSave to call Moralis.Cloud.httpRequest Post to our API.
Ok, that will not work for historical data, and it may also not work few times like when cloud code gets updated. You should also have a job that runs every x minutes to process the events that were recently added.
Now you can add some logging to see why it doesnât work.
Thank for your reply. But i did not change anything to cloud function code for a long time.
Anh i working with polygon Mumbai testnet. Anything else relate to it?
You can also paste your server url
Moralis.Cloud is not a function
This is not working in react.js
"react-moralis": â1.4.0â,
What happens? Do you see anything in network tab?
I donât see any errors in network tab.
Unhandled Rejection (TypeError): Moralis.Cloud is not a function
Moralis.Cloud(âloadNFTsâ).then(res => console.log(â=================â, res))
This seems like syntax for vanilla js. In react it may be a different syntax.
You want to call a cloud function and it doesnât work?
Try Moralis.Cloud.run(function_name_here)
Moralis.Cloud('loadNFTs') is not working as well.
Only I can use useMoralisCloudFunction from react-moralis package.
I need to call cloud function directly on clicking button.
There should be a way to do it. You can also use vanilla js syntax. That probably is Moralis.Cloud.run
Could you please let me know how to use vanilia js syntax?
You could have such too in react and call fetch()
on clicking the button
const { fetch } = useMoralisCloudFunction("loadNFTs", {}, { autoFetch: false });