Is there a better node? The default provider often fails

I using

const provider = await Provider.create(TESTNET_NETWORK_URL);

It often fails due to timeout or outofgas, and occasionally 1-2 of 10 tx transactions succeed.

1 Like

Hey @Clara, thanks for reporting. will look into it and will get back to you :slight_smile:

Hey @Clara :wave:

If you’re submitting multiple transactions from the same account, in a short period of time. Then you might find that caching used UTXO’s might alleviate this issue.

2 Likes

Hi @p.s
I am testing the function of the smart contract, so the contract will be called more frequently, which only involves gas. In the js sdk, I do not see which utxo can be selected to pay for the gas operation.

Have you tried setting the cacheUtxo flag?

const provider = await Provider.create(TESTNET_NETWORK_URL, {
  cacheUtxo: 5000, // cache UTXO for 5 seconds
});
1 Like

Hi @p.s
I tried as your guild, but still got timeout many times.

TypeError: fetch failed
    at node:internal/deps/undici/undici:12502:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 104.22.48.221:443, 104.22.49.221:443, 172.67.42.78:443)        
      at onConnectTimeout (node:internal/deps/undici/undici:6635:28)
      at node:internal/deps/undici/undici:6587:50
      at Immediate._onImmediate (node:internal/deps/undici/undici:6617:37)
      at process.processImmediate (node:internal/timers:478:21) {
    code: 'UND_ERR_CONNECT_TIMEOUT'
  }
}

Hey @Clara how are you?

We are sorry about this error. Could you please provide us with more details to help us understand the issue better? Specifically, it would be very helpful if you could share the exact error message(s) that appears when the transactions fail.

Additionally, if possible, could you show us the section of the code where you are submitting the transactions?

Thanks in advance.

Hi @Torres-ssf
The above error message is all the error messages

@Clara A section of code that is making this request will be really valuable here.

I’d also be interested in knowing the version of the TS SDK (fuels) and node you’re using.

Hi @p.s @Torres-ssf

Node.js v20.14.0
"fuels": "^0.90.0",

my test contract is 0x2092f48d9bdca1c58d4e274b28338bfc985d5b6f88983d7eecf44b8ed38146d7
my js call is like this

let info = await deployedContract.functions.claim_constellation().callParams().call();

If you want to get the contract abi, you can go to our github: GitHub - constellationbattle/game

Do you experience the same error when developing locally?

The tests I did on the test network were sometimes relatively smooth, and sometimes there were constant connect timeouts. Could it be related to the network?

Could you try running a node locally, and testing against that?

We might be able to narrow down the issue from there.

Okay, after I finish developing part of the contract’s functions, I will try to run a local node

1 Like