Getting error while calling sender.transfer

ts-sdk version: ^0.101.0
Fuel-core : 0.43.1
CODE:
let provider = new Provider(this.config.rpcUrl);
const sender = Wallet.fromPrivateKey(fromAccount.data.privateKey, provider);
response = await sender.batchTransfer([{amount: args.balance, assetId: args.assetId,destination: destination.address}]);

ERROR:
responseClone.body?.getReader is not a function
TypeError: responseClone.body?.getReader is not a function
at parseGraphqlResponse (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:6339:40)
at Provider.fetchAndProcessBlockHeight (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:6511:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async FuelGraphqlSubscriber.create (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:2248:22)

at async _Provider.sendTransaction (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:6931:26)

Hey @Prasanth :waving_hand:

This would seem to suggest that the response from the server doesn’t have a body, however, this should retry on failure and fail gracefully. I will add an issue for that now.

What RPC URL are you attempting to interact with?

Hello @p.s

I am sharing the RPC URL: https://mainnet.fuel.network/v1/graphql. We are facing this issue in production. I have tried most of the troubleshooting steps. Please help me resolve this issue.

1 Like

Hi @Prasanth,

I’ve been struggle to replicate this. A potential fix for now would be to disable the RPC consistency mechanism. Could you try the following and let me know how you get on?

Provider.ENABLE_RPC_CONSISTENCY = false;

Hi @p.s ,

I am getting a new error when setting this command.
Provider.ENABLE_RPC_CONSISTENCY = false;

I am sharing the error I encountered.
TypeError: response.body.tee is not a function

at FuelGraphqlSubscriber.create (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:2261:55)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async _Provider.sendTransaction (file:///home/ubuntu/Apps/custodian_backend/node_modules/@fuel-ts/account/dist/index.mjs:6932:26)

This is the response format I am getting in this file before
node_modules/@fuel-ts/account/dist/index.mjs:2261

Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: {
body: PassThrough {
_events: [Object],
_readableState: [ReadableState],
_writableState: [WritableState],
allowHalfOpen: true,
_maxListeners: undefined,
_eventsCount: 5,
[Symbol(shapeMode)]: true,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
disturbed: false,
error: null
},
[Symbol(Response internals)]: {
url: ‘https://mainnet.fuel.network/v1/graphql-sub’,
status: 200,
statusText: ‘OK’,
headers: Headers { [Symbol(map)]: [Object: null prototype] },
counter: 0
}
}

Okay - thanks for giving that a go.

Please could you provide me some extra information:

  • A timestamp that you made the request.
  • Runtime environment (node, bun, etc) and version you’re currently using.

Hey @Prasanth :waving_hand:

Hope you’re well!

I’ve pushed through a PR to detect and throw an error with additional information about what potentially is going wrong. I did a lot of testing to try and replicate this, and was unsuccessful in my attempts.

My only thought would be that something on your server is blocking the connection for the subscription - have you tried running this on your local machine?

Hello @p.s

I haven’t tried this locally, but I ran the same commands in the Node console, and the transaction worked properly. However, I’m encountering the issue when using the API.

I’m using Node.js version 20.18.1. Initially, my TypeScript SDK version was 0.73. Due to the older SDK version, we faced the issue mentioned below. That’s why we upgraded to the latest version, 0.101.0. If there is a solution available for the older version, we are open to downgrading.

Error Message:

The Fuel Node you’re trying to connect to is using fuel-core version 0.43.2, which is not supported by the TypeScript SDK version you are using.

Supported fuel-core version: 0.31.0.

As a result, things may not work as expected.

This does sound like an issue with the server connectivity, rather than with the TS SDK itself. It’d be worthwhile checking the logs on the server to check whether your system is denying the connection between the server and the node.

This error message is just a warning/disclaimer that things may not work as expected, not that they will. Please feel free to downgrade if it unblocks you for this time.

Hello @p.s
I tried downgrading my Fuel version to ^0.93.0. Now, I’m getting this error in the node modules and sharing the response I received from the node modules, which does not contain getReader().

TypeError: response.body.getReader is not a function
  at _FuelGraphqlSubscriber.setStream (file:///home/ubuntu/Apps/custodian_backend/node_modules/fuels/node_modules/@fuel-ts/account/dist/index.mjs:1086:33)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async _FuelGraphqlSubscriber.next (file:///home/ubuntu/Apps/custodian_backend/node_modules/fuels/node_modules/@fuel-ts/account/dist/index.mjs:1092:7)
  at async TransactionResponse.fetch (file:///home/ubuntu/Apps/custodian_backend/node_modules/fuels/node_modules/@fuel-ts/account/dist/index.mjs:3675:39)
  at async TransactionResponse.create (file:///home/ubuntu/Apps/custodian_backend/node_modules/fuels/node_modules/@fuel-ts/account/dist/index.mjs:3659:5)
  at async Fuel.executeTransaction 
Response {
   size: 0,
   timeout: 0,
   [Symbol(Body internals)]: {
     body: PassThrough {
       _events: [Object],
       _readableState: [ReadableState],
       _writableState: [WritableState],
       allowHalfOpen: true,
       _maxListeners: undefined,
       _eventsCount: 5,
       [Symbol(shapeMode)]: true,
       [Symbol(kCapture)]: false,
       [Symbol(kCallback)]: null
     },
     disturbed: false,
     error: null
   },
   [Symbol(Response internals)]: {
     url: 'https://mainnet.fuel.network/v1/graphql-sub',
     status: 200,
     statusText: 'OK',
     headers: Headers { [Symbol(map)]: [Object: null prototype] },
     counter: 0
   }
 }```

Could you verify your code works as expected locally please?

My code is still working properly in the Node console. It has been running for more than 6 months without issues, but suddenly we are facing this problem.