Sentinel fails inconsistently

:computer: Environment

I'm having an issue with Autotasks


I have an autotask running for several days. But In the last few, the same autotask has being failing from time to time. Giving timeouts.
It works 4 out of 5 times in average.

:1234: Code to reproduce

And this a the Failed Transaction

Hey @SandmanFinance! This could be caused by a slow network provider in our backend. Do you mind sharing your Autotask ID, so we can pinpoint the culprit? You can get it from the URL.

This is the ID: 5d262dd3-2150-471a-ba6b-55fd3ad28ea4 of the picture.
But also we had issues on this: b21f1322-5db7-4ffe-a9d9-f5ca42252098, e426ffee-6145-40bb-914b-899c2c937a25

Just a couple of examples.

Thank you!

Something to add:

Sometimes, you get an "success" status on your dashboard, but actually the transaction failed.

Check this ID: 52ee49f9-7310-4dbd-9061-917ab7689f7c

And the transaction associated failed:

Hey @SandmanFinance! We've removed some faulty/slow RPC providers for Polygon from Defender two days ago, which should have reduced the number of timeouts. Can you confirm if you're still experiencing timeouts in your Autotask?

About this: the relayer API returns a success when the transaction is sent, but it doesn't wait for it to be mined, since that could take several minutes (if not more, on low gas prices). It then keeps monitoring the tx (and resubmitting as needed) to make sure it gets mined. In the case you linked, the tx was successfully mined, but it reverted. Given it was an out-of-gas error, I'd suggest you pad your txs with some extra gas limit to prevent these issues.

How can I add extra gas to the TX? I can't find that option in my dashboard.

You need to add a gasLimit option when you send the transaction. For example, if you're using ethers.js:

const erc20 = new ethers.Contract(ERC20_ADDRESS, ERC20_ABI, signer);
const tx = await erc20.functions.transfer(beneficiary, 1e18.toString(), { gasLimit: 1e6 });

The above is just an example. Make sure to check what gas limit you need for your specific use case. You can also run an estimateGas to get an approximation, and then add an extra on top of that to be safe.