plugCubed/plugAPI

Bot gets 403 error, restarts at random intervals

Closed this issue · 7 comments

.../node_modules/plugapi/lib/client.js:625
                                throw new Error(err);
                                ^

Error: HTTPError: Response code 403 (FORBIDDEN)
    at process.nextTick (.../node_modules/plugapi/lib/client.js:625:39)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
{}
error: Forever detected script exited with code: 1
error: Script restart attempt #1
13:36:21s 768ms [Info]      [PlugAPI]       Running plugAPI v5.0.0

changing it to throw err instead of throw new Error(err) may give a more useful stack trace

Doesn't really seem that much more helpful to me:

.../node_modules/plugapi/lib/client.js:625
                                throw err;
                                ^

Error: Response code 403 (FORBIDDEN)
    at stream.catch.then.data (.../node_modules/got/index.js:372:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)
{}
error: Forever detected script exited with code: 1
error: Script restart attempt #2
14:14:14s 427ms [Info]      [PlugAPI]       Running plugAPI v5.0.0

Dang, was hoping for a stack trace that pointed to a line in client.js. guess not!

Unfortunately, information about the call stack that called _sendRest gets lost due to the async nature of the call. I suppose logging the value of opts on error could help..

The request url was https://plug.dj/_/booth and err contains this:

{"name":"HTTPError","host":"plug.dj","hostname":"plug.dj","method":"POST","path":"/_/booth","protocol":"https:","url":"https://plug.dj/_/booth","statusCode":403,"statusMessage":"FORBIDDEN","headers":{"content-type":"application/json","date":"Thu, 03 May 2018 12:52:56 GMT","server":"nginx/1.14.0","set-cookie":["session=XXX; Expires=Sat, 02-Jun-2018 12:52:56 GMT; Secure; HttpOnly; Path=/"],"content-length":"145","connection":"keep-alive"}}

Just got one for https://plug.dj/_/playlists/9084662/media/delete
This seems to confirm my suspicion that this is some sort of rate limiting issue.

After doing some research, this is related to trying to delete a song that is being played and joining the booth with no songs to play.