lcs icon indicating copy to clipboard operation
lcs copied to clipboard

LCS restarts when running into a FetchError.

Open Avi0n opened this issue 2 years ago • 1 comments

When a remote instance can't be reached or returns invalid json, LCS continually restarts instead of skipping the instance it can't reach.

Checking lemmy.sdf.org for posts of Hot

/app/node_modules/node-fetch/lib/index.js:1505
                        reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
                               ^
FetchError: request to https://lemmy.sdf.org/api/v3/post/list?type_=All&sort=Hot&limit=50 failed, reason: connect ECONNREFUSED 205.166.94.11:443
    at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1505:11)
    at ClientRequest.emit (node:events:511:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:511: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: 'ECONNREFUSED',
  code: 'ECONNREFUSED'
}

Node.js v20.3.1

> [email protected] start
> node index.js
Checking lemmy.world for posts of TopDay

/app/node_modules/node-fetch/lib/index.js:273
                                return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json'));
                                                           ^
FetchError: invalid json response body at https://lemmy.world/api/v3/post/list?type_=All&sort=TopDay&limit=50 reason: Unexpected token '<', "<html>
<h"... is not valid JSON
    at /app/node_modules/node-fetch/lib/index.js:273:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'invalid-json'
}

Node.js v20.3.1

> [email protected] start
> node index.js

Avi0n avatar Jul 03 '23 15:07 Avi0n

This issue seems to actually crash my instance causing a lemmy to enter a loop of this issue: https://github.com/LemmyNet/lemmy/issues/3661

joeknock90 avatar Jul 30 '23 22:07 joeknock90