my code is a simple bridge i modeled from the moralis tutorial at https://moralis.io/how-to-build-a-cross-chain-bridge/. it was working two days ago and now I have returned to it and its not working. I made sure to prevent it from sleeping and no changes were made. Were any syntax updates recently added? this has happened to me before where I had to change to updated syntax (when web3ByChain was deprecated around the end of June I believe). My cloud code is no longer even making it into the “Moralis.Cloud.afterSave(“EthTokenTransfers”, (request) => {}” portion which is where I suspect the syntax changes may have been made? Any ideas where I can look or what the issue may be?
Here is the start of my code
const logger = Moralis.Cloud.getLogger();
web3Main = new Moralis.Web3(
new Moralis.Web3.providers.HttpProvider(
“https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161”
)
);
web3Side = new Moralis.Web3(
new Moralis.Web3.providers.HttpProvider(
“https://rpc-mumbai.maticvigil.com/”
)
);
const MainBridge_address = “0xFE439F397f4285a327c0884955c1bFB2770FD8B1”;
const SideBridge_address = “0x7a9dFD9bD2897a3861a1E24511C9502304Ab5e71”;
const mainToken_address = “0xB856BCB0ecd646b864C3D2Ae460956E201540682”;
const childToken_address = “0x53af351a15315C78A8BEf238c1dcF38325Dd819B”;
const gateway_address = “0x42A028e9d8f0Bd6858a782AECC90C56B04365a01”
const gatewayKey = “”
const MainBridge_abi = “”
const SideBridge_abi = “”
const MainBridge = new web3Main.eth.Contract(JSON.parse(MainBridge_abi),MainBridge_address);
const SideBridge = new web3Side.eth.Contract(JSON.parse(SideBridge_abi),SideBridge_address);
Moralis.Cloud.afterSave(“EthTokenTransfers”, (request) => {
const data = JSON.parse(JSON.stringify(request.object, [“token_address”, “to_address”, “from_address”,“transaction_hash”,“value”, “confirmed”]));
logger.info(data);
There are no recent changes in cloud code syntax
Do you see any errors in your database logs?
No I do not see any errors. If I put any logger.info() statements after the Moralis.Cloud.afterSave line they do not show up in the database logs either
If possible can you share your server url?
As per the database logs these are the last errors from cloud code, which happened today.
And the last row in EthTokenTransfers
class was created on 21 July, so that can be why afterSave
is not triggered on EthTokenTransfers
class.
When I discovered it was broken, I messed with the cloud code a few times to try to diagnose the problem, which is where these errors came from. I’ve since returned the code to its original state which does not produce these errors.
Additionally, the last instance of EthTokenTransfers says July 21, but I’ve made transfers in the last 24 hours that should have been picked up.
Is there somewhere I can find more info on the EthTokenTransfers trigger to keep trying to troubleshoot?
Thank you so much again
Can you try removing the wallet address from sync and add it back to sync again. If the sync is fixed it should also trigger the afterSave
cloud function.
it will not trigger afterSave while historical sync will run, only for real time sync, but I would expect to see the data synced in that EthTokenTransfers table
This was the solution! Thank you very much. Do you know why this problem occurred?
Thank you so much. It is now working I appreciate your help!