Magickbase / neuron-public-issues

Neuron Issues
6 stars 3 forks source link

FetchError: request to http://127.0.0.1:8114/ failed, reason: socket hang up on yarn start #389

Open twhy opened 4 months ago

twhy commented 4 months ago

Environment

MacOS 14.4.1
Node v20.12.2

Reproduce Steps

  1. Git clone Neuron
  2. Follow setup steps in README
  3. yarn start

Cause

This is caused by a known issue in node-fetch

Fixed in v2.6.13 https://github.com/node-fetch/node-fetch/pull/1765 Fixed in v3.3.2 https://github.com/node-fetch/node-fetch/issues/1735

The current resolved version of node-fetch in Neuron is 2.6.11

I add "node-fetch": "2.6.13" to resolutions in root package.json to fix this locally.

Terminal Log

[0] Issues checking in progress...
$ cd packages/neuron-wallet && yarn run start:debug
$ yarn run build && electron --inspect=5858 .
$ tsc
[0] No issues found.
[1] Debugger listening on ws://127.0.0.1:5858/59ded658-2de4-4ac2-b720-84e26e905d39
[1] For help, see: https://nodejs.org/en/docs/inspector
[1] [2024-05-07T02:45:06.865Z] [info]  App: Neuron is starting
[1] [2024-05-07T02:45:06.913Z] [warn]  function call error: TypeError: fetch failed, retry 2 ...
[1] [2024-05-07T02:45:07.015Z] [warn]  function call error: TypeError: fetch failed, retry 3 ...
[1] [2024-05-07T02:45:07.123Z] [error] Network: fail to connect to the network. Is CKB node running?
[1] [2024-05-07T02:45:07.181Z] [info]  Network: switched to: {
[1]   id: 'mainnet',
[1]   name: 'Internal Node',
[1]   remote: 'http://127.0.0.1:8114',
[1]   genesisHash: '0x92b197aa1fba0f63633922c61c92375c9c074a93e85963554f5499fe1450d0e5',
[1]   type: 0,
[1]   chain: 'ckb',
[1]   readonly: true
[1] } false
[1] [2024-05-07T02:45:07.313Z] [warn]  function call error: TypeError: fetch failed, retry 2 ...
[1] [2024-05-07T02:45:07.419Z] [warn]  function call error: TypeError: fetch failed, retry 3 ...
[1] [2024-05-07T02:45:07.521Z] [info]  CKB: external RPC on default uri not detected, starting bundled CKB node.
[1] [2024-05-07T02:45:07.868Z] [info]  Checking for update
[1] [2024-05-07T02:45:08.524Z] [info]  CKB: Initializing node...
[1] [2024-05-07T02:45:08.526Z] [info]  CKB: init: config file detected, skip ckb init.
[1] [2024-05-07T02:45:08.535Z] [info]  CKB: ckb full node will with rpc port 8114, listen port 8115, with options [
[1]   'run',
[1]   '-C',
[1]   '/Volumes/SSD/Nervos/neuron/chains/mainnet',
[1]   '--indexer'
[1] ]
[1] [2024-05-07T02:45:11.690Z] [info]  Update for version 0.114.3 is not available (latest version: 0.114.3, downgrade is disallowed).
[1] [2024-05-07T02:45:20.592Z] [debug] Network: connected successfully
[1] [2024-05-07T02:45:20.601Z] [info]  Network: reconnected to: {
[1]   id: 'mainnet',
[1]   name: 'Internal Node',
[1]   remote: 'http://127.0.0.1:8114',
[1]   genesisHash: '0x92b197aa1fba0f63633922c61c92375c9c074a93e85963554f5499fe1450d0e5',
[1]   type: 0,
[1]   chain: 'ckb',
[1]   readonly: true
[1] } true
[1] [2024-05-07T02:45:23.614Z] [info]  Sync:    start
[1] [2024-05-07T02:45:23.648Z] [error] Sync:ChildProcess: Debugger listening on ws://127.0.0.1:9229/5acc0944-6e7a-4973-b149-2ef6d486b377
[1] For help, see: https://nodejs.org/en/docs/inspector
[1] 
[1] [2024-05-07T02:45:24.217Z] [info]  Queue:   start
[1] [2024-05-07T02:45:24.253Z] [error] Sync:ChildProcess: [2024-05-07T02:45:24.253Z] [error] Unhandled Rejection in task:   Reason: FetchError: request to http://127.0.0.1:8114/ failed, reason: socket hang up
[1]     at ClientRequest.<anonymous> (/Users/twhy/Code/nervos/neuron-fork/node_modules/node-fetch/lib/index.js:1505:11)
[1]     at ClientRequest.emit (node:events:518:28)
[1]     at Socket.socketOnEnd (node:_http_client:519:9)
[1]     at Socket.emit (node:events:530:35)
[1]     at endReadableNT (node:internal/streams/readable:1696:12)
[1]     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[1] 

Screenshot

image
yanguoyu commented 4 months ago

https://github.com/nervosnetwork/neuron/pull/3143