Also all the meta txns reverted from contract are not showing error messages in the explorer. The above transaction got reverted from contract but showing success message instead if showing error message. This is making difficult to revert the txn in frontend as txn is success.
not able to return any data from autotask to frontend. I am using fetch to call autotask webhook, when autotask is run, am returning data but the data is not present in fetch response.
Hey @kbhargav5, sorry for taking this long to answer. The Defender team is monitoring everything in the Defender category of the forum, so I'm moving it there.
The execution reverted is related to this question (the details are there):
Regarding the invalid signature length, I'd ask you for the contract code or a minimal reproducible script so I can take a look. The contract is not verified so I don't know what's happening under the hood
thanks @ernestognw , I have changed Minimal Forwarder contract to revert the txn with error message by including the require condition on success. Now transaction is getting failed in autotask. I need to send this txn hash or txn status from autotask to frontend. But am not able to send, as the response does not contain any result field.
documentation says response will get return values in result field, but I dont see any result field in response. Attached screenshots in the above conversation
@kbhargav5
If autotask end with failed status it means that error has been thrown and it was not cached by business logic. In order to return something as result in that case we would need to wrap our logic with try-catch block and return some value from catch block or later.
Hope that this helps.
If problem is not resolved by wrapping logic in try catch could you please share example of your autotask logic with us. Thanks
exports.handler = async function(event) {
// Parse webhook payload
if (!event.request || !event.request.body) throw new Error(`Missing payload`);
const { request, signature } = event.request.body;
console.log(`Relaying`, request);
// Initialize Relayer provider and signer, and forwarder contract
const credentials = { ... event };
const provider = new DefenderRelayProvider(credentials);
const signer = new DefenderRelaySigner(credentials, provider, { speed: 'fast' });
const forwarder = new ethers.Contract(ForwarderAddress, ForwarderAbi, signer);
// Relay transaction!
const tx = await relay(forwarder, request, signature, signer);
console.log("tx: ",tx);
return tx;
}
async function relay(forwarder, request, signature, signer) {
try{
// Validate request on the forwarder contract
console.log("verifying");
console.log("request: ",request);
console.log("signature: ",signature);
const valid = await forwarder.verify(request, signature);
if (!valid) throw new Error(`Invalid request`);
console.log("verified");
// Send meta-tx through relayer to the forwarder contract
const gasLimit = (parseInt(request.gas) + 50000).toString();
const tx = await forwarder.execute(request, signature, { gasLimit })
await tx.wait();
console.log("tx: ",tx)
return tx
}
catch(ex){
console.log("ex: ",ex);
return ex
}
}
am trying to return the result here as response to webhook call, but this response is not showing in result field. I dont see any result field in the response for neither success nor failed txns.
So above posted image didn't have body in response, thats why I asked to try via Postman.
Depending on how you invoke that webhook url from your code you may be missing await operator or something else depending on what you use.
Could you please verify that you use await higher in the chain.
If your code matches one from workshop then maybe some security policy blocks your request.
I got what is the issue. It is because of the header mode: 'no-cors', I have added this because I got CORS error with the request, but not getting now. I guess CORS error might get in future, any other way to resolve any issues from CORS
@zeljko I see one more issue, sometimes fetch is returning the response with status: pending along with autotask id, instead of success, in this case there is no result field in the response