discord bot crashing when i try to delete ticket

Viewed 76

everything works, but when i try to press delete ticket button it crashes the bot and it doesn't even delete the ticket + doesn't send the log of the ticket that it should send.

error i get when i press delete ticket button:


2022-01-11T18:42:09.631377+00:00 app[Worker.1]:                     err = new got.ParseError(e, statusCode, opts);

2022-01-11T18:42:09.631378+00:00 app[Worker.1]:                           ^

2022-01-11T18:42:09.633302+00:00 app[Worker.1]: ErrorClass [ParseError]: Unexpected token '<' at 1:1 in https://hastebin.com/documents

2022-01-11T18:42:09.633304+00:00 app[Worker.1]: <!DOCTYPE HTML>

2022-01-11T18:42:09.633305+00:00 app[Worker.1]: ^

2022-01-11T18:42:09.633305+00:00 app[Worker.1]:     at /app/node_modules/got/index.js:115:12

2022-01-11T18:42:09.633306+00:00 app[Worker.1]:     at BufferStream.<anonymous> (/app/node_modules/read-all-stream/index.js:64:3)

2022-01-11T18:42:09.633306+00:00 app[Worker.1]:     at BufferStream.emit (node:events:402:35)

2022-01-11T18:42:09.633306+00:00 app[Worker.1]:     at finishMaybe (/app/node_modules/readable-stream/lib/_stream_writable.js:630:14)

2022-01-11T18:42:09.633307+00:00 app[Worker.1]:     at afterWrite (/app/node_modules/readable-stream/lib/_stream_writable.js:492:3)

2022-01-11T18:42:09.633307+00:00 app[Worker.1]:     at processTicksAndRejections (node:internal/process/task_queues:85:21) {

2022-01-11T18:42:09.633308+00:00 app[Worker.1]:   host: 'hastebin.com',

2022-01-11T18:42:09.633308+00:00 app[Worker.1]:   hostname: 'hastebin.com',

2022-01-11T18:42:09.633309+00:00 app[Worker.1]:   method: 'POST',

2022-01-11T18:42:09.633309+00:00 app[Worker.1]:   path: '/documents',

2022-01-11T18:42:09.633309+00:00 app[Worker.1]:   statusCode: 503,

2022-01-11T18:42:09.633309+00:00 app[Worker.1]:   statusMessage: 'Service Unavailable'

2022-01-11T18:42:09.633310+00:00 app[Worker.1]: }

2022-01-11T18:42:09.938311+00:00 heroku[Worker.1]: State changed from up to crashed``` 
1 Answers

From the 503 service unavailable error it looks like hastebin was experiencing problems/downtime when you encountered this error. Make sure you are checking the status code, or catching errors when you send requests and receive HTTP responses from web servers. You got a fatal error because you likely tried to parse the HTML error page body as JSON.

Related