Sometimes Rollbar API has difficulties and throws 502 or 500 errors but instead of JSON the response is html:
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.17.9</center>
</body>
</html>
This type of response isn't handled and is failing when response is being parsed:
INTERNAL_ROLLBAR_ERROR SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (<anonymous>)
at Object.jsonParse (/node_modules/rollbar/src/utility.js:356:25)
at _parseApiResponse (/node_modules/rollbar/src/server/transport.js:145:22)
at IncomingMessage.<anonymous> (/node_modules/rollbar/src/server/transport.js:120:5)
with new SyntaxError("JSON");:
726 if (state !== "ok" || (/[^\u0020\t\n\r]/.test(source))) {
727 throw (state instanceof SyntaxError)
728 ? state
729 : new SyntaxError("JSON");
729 }
Hi there,
Sometimes Rollbar API has difficulties and throws 502 or 500 errors but instead of JSON the response is html:
This type of response isn't handled and is failing when response is being parsed:
with
new SyntaxError("JSON");
: