pradel / node-instagram

Instagram api client for node that support promises.
MIT License
190 stars 27 forks source link

"Unhandled rejection" error when retrieving Instagram posts #23

Closed lmorandini closed 6 years ago

lmorandini commented 6 years ago

There are rare (1 out of 100.000 posts or so) instances in which un-handled rejections are raised from what appears to be a failed Facebook login. To be exact, the rejection in the log file gives information on a html page which I found was a Facebook 404 not found page.

This might be a result of Instagram users using third-party login.

Any idea on how to solve it?

lmorandini commented 6 years ago

A log entry showing the error: [2017-10-07 03:07:35] [ERROR] Possibly Unhandled Rejection at: Promise {"isFulfilled":false,"isRejected":true,"rejectionReason":"<!DOCTYPE html>\n<html lang=\"en\" id=\"facebook\">\n <head>\n <title>Facebook | Error</title>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"cache-control\" content=\"no-cache\">\n <meta http-equiv=\"cache-control\" content=\"no-store\">\n <meta http-equiv=\"cache-control\" content=\"max-age=0\">\n <meta http-equiv=\"expires\" content=\"-1\">\n <meta http-equiv=\"pragma\" content=\"no-cache\">\n <meta name=\"robots\" content=\"noindex,nofollow\">\n <style>\n html, body {\n color: #141823;\n background-color: #e9eaed;\n font-family: Helvetica, Lucida Grande, Arial,\n Tahoma, Verdana, sans-serif;\n margin: 0;\n padding: 0;\n text-align: center;\n }\n\n #header {\n height: 30px;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n }\n\n #icon {\n width: 30px;\n }\n\n h1 {\n font-size: 18px;\n }\n\n p {\n font-size: 13px;\n }\n\n #footer {\n border-top: 1px solid #ddd;\n color: #9197a3;\n font-size: 12px;\n padding: 5px 8px 6px 0;\n }\n </style>\n </head>\n <body>\n <div id=\"header\">\n <a href=\"//www.facebook.com/\">\n <img id=\"icon\" src=\"//static.xx.fbcdn.net/images/logos/facebook_2x.png\" />\n </a>\n </div>\n <div id=\"core\">\n <h1 id=\"sorry\">Sorry, something went wrong.</h1>\n <p id=\"promise\">\n We're working on it and we'll get it fixed as soon as we can.\n </p>\n <p id=\"back-link\">\n <a id=\"back\" href=\"//www.facebook.com/\">Go Back</a>\n </p>\n <div id=\"footer\">\n Facebook\n <span id=\"copyright\">\n &copy; 2017\n </span>\n <span id=\"help-link\">\n &#183;\n <a id=\"help\" href=\"//www.facebook.com/help/\">Help Center</a>\n </span>\n </div>\n </div>\n <script>\n document.getElementById('back').onclick = function() {\n if (history.length > 1) {\n history.back();\n return false;\n }\n };\n\n // Adjust the display based on the window size\n if (window.innerHeight < 80 || window.innerWidth < 80) {\n // Blank if window is too small\n document.body.style.display = 'none';\n };\n if (window.innerWidth < 200 || window.innerHeight < 150) {\n document.getElementById('back-link').style.display = 'none';\n document.getElementById('help-link').style.display = 'none';\n };\n if (window.innerWidth < 200) {\n document.getElementById('sorry').style.fontSize = '16px';\n };\n if (window.innerWidth < 150) {\n document.getElementById('promise').style.display = 'none';\n };\n if (window.innerHeight < 150) {\n document.getElementById('sorry').style.margin = '4px 0 0 0';\n document.getElementById('sorry').style.fontSize = '14px';\n document.getElementById('promise').style.display = 'none';\n };\n </script>\n </body>\n</html>\n"} for reason: "<!DOCTYPE html>\n<html lang=\"en\" id=\"facebook\">\n <head>\n <title>Facebook | Error</title>\n <meta charset=\"utf-8\">\n <meta http-equiv=\"cache-control\" content=\"no-cache\">\n <meta http-equiv=\"cache-control\" content=\"no-store\">\n <meta http-equiv=\"cache-control\" content=\"max-age=0\">\n <meta http-equiv=\"expires\" content=\"-1\">\n <meta http-equiv=\"pragma\" content=\"no-cache\">\n <meta name=\"robots\" content=\"noindex,nofollow\">\n <style>\n html, body {\n color: #141823;\n background-color: #e9eaed;\n font-family: Helvetica, Lucida Grande, Arial,\n Tahoma, Verdana, sans-serif;\n margin: 0;\n padding: 0;\n text-align: center;\n }\n\n #header {\n height: 30px;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n }\n\n #icon {\n width: 30px;\n }\n\n h1 {\n font-size: 18px;\n }\n\n p {\n font-size: 13px;\n }\n\n #footer {\n border-top: 1px solid #ddd;\n color: #9197a3;\n font-size: 12px;\n padding: 5px 8px 6px 0;\n }\n </style>\n </head>\n <body>\n <div id=\"header\">\n <a href=\"//www.facebook.com/\">\n <img id=\"icon\" src=\"//static.xx.fbcdn.net/images/logos/facebook_2x.png\" />\n </a>\n </div>\n <div id=\"core\">\n <h1 id=\"sorry\">Sorry, something went wrong.</h1>\n <p id=\"promise\">\n We're working on it and we'll get it fixed as soon as we can.\n </p>\n <p id=\"back-link\">\n <a id=\"back\" href=\"//www.facebook.com/\">Go Back</a>\n </p>\n <div id=\"footer\">\n Facebook\n <span id=\"copyright\">\n &copy; 2017\n </span>\n <span id=\"help-link\">\n &#183;\n <a id=\"help\" href=\"//www.facebook.com/help/\">Help Center</a>\n </span>\n </div>\n </div>\n <script>\n document.getElementById('back').onclick = function() {\n if (history.length > 1) {\n history.back();\n return false;\n }\n };\n\n // Adjust the display based on the window size\n if (window.innerHeight < 80 || window.innerWidth < 80) {\n // Blank if window is too small\n document.body.style.display = 'none';\n };\n if (window.innerWidth < 200 || window.innerHeight < 150) {\n document.getElementById('back-link').style.display = 'none';\n document.getElementById('help-link').style.display = 'none';\n };\n if (window.innerWidth < 200) {\n document.getElementById('sorry').style.fontSize = '16px';\n };\n if (window.innerWidth < 150) {\n document.getElementById('promise').style.display = 'none';\n };\n if (window.innerHeight < 150) {\n document.getElementById('sorry').style.margin = '4px 0 0 0';\n document.getElementById('sorry').style.fontSize = '14px';\n document.getElementById('promise').style.display = 'none';\n };\n </script>\n </body>\n</html>\n"

pradel commented 6 years ago

That's really weird ... I never had this error. On which route do you get these errors?