Mondanzo/node-curseforge

Unexpected End of JSON input

Davoleo opened this issue · 1 comments

When trying to request game versions of the 2 games listed below an internal exception is thrown with the following message and stacktrace:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at IncomingMessage.<anonymous> (D:\Everything\Coding\misc\curse-updates\node_modules\node-curseforge\dist\utils.js:51:34)
    at IncomingMessage.emit (node:events:406:35)
    at endReadableNT (node:internal/streams/readable:1343:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Related API Endpoint: /v1/games/{gameId}/versions

Games Where this issue occurs and is reproduceable:

  • Terraria (id: 431)
  • Starcraft II (id: 65)

Note: this seems to be related to the fact the API returns 404 when requesting game versions for these titles directly

HTTP/1.1 404 Not Found
Content-Length: 0
Connection: close
Date: Mon, 16 May 2022 17:33:24 GMT
X-Cache: Error from cloudfront
Via: 1.1 f0f5607a03d2ae4c43b553dc2cef0c9e.cloudfront.net (CloudFront)

Ya gotta love Curseforge and their inconsistency. I guess best I could try to do is add a nullable type to the response