gadingnst/kampus-scraper

Possible too many requests error on `getMahasiswa` query

Closed this issue ยท 3 comments

First of all, this is a wonderful project! ๐Ÿ‘

Spent some time testing queries and encountered many times of unexpected character errors if sending too much getMahasiswa queries for some time. Below are screenshots and query results for failed and successful queries:

Failed query

image

{
  "error": "JSON.parse: unexpected character at line 1 column 1 of the JSON data"
}
Successful query

image

{
  "data": {
    "getMahasiswa": {
      "nim": "062014106379",
      "nama": "GRIKO MUHAMMAD SULTAN NIBRAS",
      ...
    }
  }
}

Any references on where should I look in the codebase? Would love to help this project, but I'm fairly new to Apollo. ๐Ÿ˜„

Well, it because Zeit https://zeit.co limit the request timeout only 10s in free plan.

Here is the runtime log from Zeit:

2020-01-19T08:16:32.364Z 27bfd9df-8bc7-4bb7-82bf-926530fb3119 Task timed
out after 10.01 seconds

But, currently i dont know to handle the response message if that error occurs
again, because i've no idea to see application log from Zeit. If you know to handle that error, you should handle in schema/mahasiswa.js at getMahasiswa() resolver. Or maybe we can listen the error globally in server.js.

Make it possible!, donate developer now hahahaha LoL