harmony-one / sdk

Javascript SDK of Harmony protocol.
MIT License
91 stars 44 forks source link

Another Harmony SDK bug `FetchError: invalid json response body at https://api.s0.t.hmny.io/ reason: Unexpected token < in JSON at position 0` #110

Open trekze opened 2 years ago

trekze commented 2 years ago

This happens on occasion when calling the transfer method of our HRC20 contract.

The SDK doesn't recover from it.


15|withdraw-handler  | Error: FetchError: invalid json response body at https://api.s0.t.hmny.io/ reason: Unexpected token < in JSON at position 0
15|withdraw-handler  |     at Messenger.<anonymous> (/path/dev/crypto_royale/node_modules/@harmony-js/network/dist/messenger/messenger.js:82:35)
15|withdraw-handler  |     at step (/path/dev/crypto_royale/node_modules/tslib/tslib.js:143:27)
15|withdraw-handler  |     at Object.throw (/path/dev/crypto_royale/node_modules/tslib/tslib.js:124:57)
15|withdraw-handler  |     at rejected (/path/dev/crypto_royale/node_modules/tslib/tslib.js:115:69)
15|withdraw-handler  |     at runMicrotasks (<anonymous>)
15|withdraw-handler  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)```
neeboo commented 2 years ago

Sorry to have you encountered so many problems, since the SDK has not been updated for a while. Maybe there are some issues undiscovered during this time, harmony's mainnet apis may have been changed or upgraded a lot.

Plus some of the dependencies of this SDK haven't been updated and may not be compatible for newer nodejs and browsers.

I may be the author of this sdk but actually been away from this project for couple months. Better ask the maintainer of this repo to upgrade , or you may seek the other way to complete your job. Seems that harmony has moved to use Web3/ethereum compatible tool to do the job, so you would better check that out