kerolloz / codeforces-api-ts

Codeforces-API-TS is a NodeJS Client Library for Codeforces API with Typescript support
MIT License
5 stars 0 forks source link

SyntaxError during fetch of contest lists #6

Open adithyagenie opened 4 months ago

adithyagenie commented 4 months ago

While running const res = await CodeforcesAPI.call("contest.list", {}); I get an error.

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJSONFromBytes (node:internal/deps/undici/undici:4306:19)
    at successSteps (node:internal/deps/undici/undici:4288:27)
    at fullyReadBody (node:internal/deps/undici/undici:2724:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async consumeBody (node:internal/deps/undici/undici:4297:7)
    at async Object.call (/app/node_modules/.pnpm/codeforces-api-ts@3.0.1/node_modules/codeforces-api-ts/dist/codeforces.js:36:17)
    at async cfFetchContests (/app/out/api/cfFetch.js:6:17)
    at async cfSchedule (/app/out/helpers/cfSchedule.js:8:22)
    at async contestScheduler (/app/out/helpers/scheduler.js:12:5)

This seems to happen when codeforces api is down and returns Codeforces is temporarily unavailable. Please, return in several minutes. Please try [m1.codeforces.com](https://m1.codeforces.com/), [m2.codeforces.com](https://m2.codeforces.com/) or [m3.codeforces.com](https://m3.codeforces.com/).