Since a couple of days I often face timeout when I run my NodeJS command lines that interacts with the IC on mainnet but I’m not sure if it’s something on my hand (NodeJS version, Macos, network etc.) or if something on the IC side.
Has anyone else being to face recently timeout in his/her scripts?
Sound like a network issue. I was in the office today, stayed there after work to developed few stuffs and had no issue. Just went home and timeout happened again, so restarted my router, let’s see.
I believe this is an issue between how fetch is implemented in Node 16 vs. Node 18. I ran into this issue when beta testing some IC software, and ran into similar issues originally when developing the CanDB frontend client sdk. It might be this plus a combination older version of the sdk being run that is expecting a particular node version?
Try downgrading from Node 18 to Node 16 and let me know if the issue still persists.
Also, what version of node are you currently using?
Hello Everyone … @icme is right, Node 16 seems happy, Node 18.14, not so happy … intermittent timeouts … usually in succession … fail fail fail fail, success, success, success, fail fail … etc … just confirmed latest @dfinity npm packages 0.15.3 …
Error in checkTokenResponse: ICPM Error: FetchError: request to https://ic0.app/api/v2/canister/5zc2i-mqaaa-aaaal-abcoa-cai/read_state failed, reason: connect ETIMEDOUT 2600:c00:2:100:5000:d0ff:fe62:c29b:443
Error in checkTokenResponse: ICPM Error: FetchError: request to https://ic0.app/api/v2/canister/5zc2i-mqaaa-aaaal-abcoa-cai/call failed, reason: connect ETIMEDOUT 2600:c00:2:100:5000:d0ff:fe62:c29b:443
notice too that the endpoints are different … @rckprtr 's was a ‘/query’ and this shows ‘/call’ and ‘/read_state’ … makes it seem like @icme said that it may be the new implementation of fetch … an api issue at the boundary?
And today is the first we have had such an issue on my end … not sure if it matters … @icme and I are in California … and I have a colleague in NY who has 0 issues with either 16 or 18 … maybe certain boundary nodes? … just guessing …
Regardless of the NodeJS version go the error. I’ve forwarded following stacktrace and sample repo to reproduce the issue.
❯ npm run start
> @junobuild/example-node@0.0.1 start
> node index.mjs
This is a demo client in NodeJS
file:///Users/daviddalbusco/projects/juno/examples/node/node_modules/node-fetch/src/index.js:108
reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, 'system', error));
^
FetchError: request to https://ic0.app/api/v2/canister/xo2hm-lqaaa-aaaal-ab3oa-cai/query failed, reason: connect ETIMEDOUT 2a0b:21c0:4003:2:5000:55ff:feb8:5f89:443
at ClientRequest.<anonymous> (file:///Users/daviddalbusco/projects/juno/examples/node/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:525:35)
at TLSSocket.socketErrorListener (node:_http_client:494:9)
at TLSSocket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
erroredSysCall: 'connect'
}
Node.js v18.12.1
sample:
git clone https://github.com/buildwithjuno/examples
cd examples/node
npm ci
npm run start
Following this as well, in US on the east coast, unable to duplicate the network timeout issues from here.
Peter, my run of your test seems happy with all flavors Node 18+. Have verified with 18.14/LTS, 18.13 (previous LTS), and 18.12.1 (the version in your example).
I’ve incurred no blips at all on repeated tries with all the above. We just don’t seem to having boundary/API quirks as you’re seeing farther west.
Node 16 does fail for me, but it seems like a different issue … undefined ‘Headers’ on invocation of your get() method(??)