anzemur / chess-api

Chess API: REST API for playing chess and storing highscores
MIT License
43 stars 24 forks source link

Keep getting "error: The game has expired OR you didn't put the game_id as the parameter!" #2

Open apapadakuni opened 5 years ago

apapadakuni commented 5 years ago

Hi,

I keep getting "error: The game has expired OR you didn't put the game_id as the parameter!" even though I have created the game and pass the game_id as the parameter. This happens with any of the POSTs, such as Move Figure Player. I have tried both in Postman and in code.

anzemur commented 5 years ago

Hello,

the api, even without my maintenance should still work fine. Are you sure your requests have Content-Type header set to application/x-www-form-urlencoded and you are sending them in a correct way?

You can see the working example of the api here.

conema commented 5 years ago

The same happened to me, I have no problem if I host myself the APIs. It feels like the db is being deleted with a very little interval

anzemur commented 5 years ago

Chessboard expires after 2 hours, so it gets deleted from the database.

conema commented 5 years ago

I'm talking about very few minutes or instantly. I've not used this API for a few months, but in the past I had the same problem as @apapadakuni. Maybe there is some sort of daily data limit in mongodb?

I'm thinking about a limit because, as I said in my last comment, I had no problems if I host it myself (with the same architecture - heroku + mondodb atlas), maybe your api endpoint is receiving too much requests.

Dummiez commented 5 years ago

Hi, after some more thorough investigation I've noticed in the chessboardModel.js that the chess schema actually expires 2 hours from the initial startup rather than the time the schema was created so after a while when you try to start a new game id and schema past the 2 hour startup it's already expired. Also explains why sometimes in the heroku api game ids expire randomly after 1-2 minutes.

xastrobyte commented 3 years ago

Yeah i have this issue too. I built chess using this API into a discord bot and i constantly get the same error even though i just started the game