jublo / codebird-js

A Twitter library in JavaScript.
https://www.jublo.net/projects/codebird/js
GNU General Public License v3.0
384 stars 97 forks source link

GET Request Response Headers Not Loading #137

Closed superjoefly closed 7 years ago

superjoefly commented 7 years ago

This is in relation to the Object {httpstatus: 0} response.

When I make a call using the following code, it seems that the response headers aren't loading and I'm still getting the response mentioned above.

      search() {
        console.log('Search!');
        var cb = new Codebird;
        cb.setConsumerKey("...", "...");

             cb.__call(
              "search_tweets",
              "q=" + this.term,
                function (reply) {
                       console.log(reply);
             }
         );
      }

In Firefox Dev Tools, I'm looking at Net / Get / Response headers and there is a loading spinner that just keeps spinning. Is this the related to the {httpresponse: 0}?

Basically I'm not getting a response from the GET request and my server is timing out.

Hope this will help with the debugging...

Thanks :-)

xasse commented 7 years ago

I got the same behaviour for: cb.__call("oauth_requestToken", { oauth_callback: redirectUri }, function(reply) { console.log(reply); });

jediwade commented 7 years ago

Same here. Getting "Object {httpstatus: 0}".

Using:

cb.call("oauth2_token", {}, function(reply) { var bearer_token = reply.access_token; cb.setBearerToken(bearer_token); }); cb.call("search_tweets", hashtagParams, twitterHashtagCallback, true);

The above code has been working for 7 or 8 months and just quit working yesterday.

pjazdzewski1990 commented 7 years ago

The same for me. In general, I see that doing curl 'https://api.jublo.net/codebird/oauth2/token' ... succeeds, but after a long wait (~ 1 minute). Which most probably causes JS code to timeout and fail.

Dear Jublo team, any predictions on what is the issue and when could this be resolved? Maybe that's just a matter of restarting the server? If this is a bigger thing, I (and other probably as well) would be thankful for some hints on how to deal with the situation.

Thanks

joshuaatkins commented 7 years ago

Hi guys,

We've have made (considerable) changes to our infrastructure. Can you confirm if this has made the improvements required?

Thanks,

Josh

jediwade commented 7 years ago

Sometimes it works, sometimes it doesn't. When it does work, I am seeing a few errors in console:

x2 POST https://api.jublo.net/codebird/oauth2/token 502 (Bad Gateway) XMLHttpRequest cannot load https://api.jublo.net/codebird/oauth2/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. XHR failed loading: POST "https://api.jublo.net/codebird/oauth2/token". Uncaught TypeError: Cannot read property 'access_token' of null at social.js:551 at XMLHttpRequest.xml.onerror (codebird.js:1336) (anonymous) @ social.js:551 xml.onerror @ codebird.js:1336

Code from my "social.js" file

550: cb.__call("oauth2_token", {}, function(reply) {
551:    var bearer_token = reply.access_token;
552:    cb.setBearerToken(bearer_token);
553: });
joshuaatkins commented 7 years ago

Hi @wadedwalker, Can you confirm the IP 'api.jublo.net' resolves to?

pjazdzewski1990 commented 7 years ago

@joshuaatkins My personal use case has been fixed. Thank you

jediwade commented 7 years ago

@joshuaatkins Pinging that address gives me "213.202.223.28". When I visit the URL in the browser (Windows Chrome 59.0.3071.115, no active plugins or apps), I get 502 Bad Gateway. If I go to the IP address directly, I get 404. Is that what you were wanting to know?

jediwade commented 7 years ago

@joshuaatkins I have been performing several refreshes since you replied so quickly and I haven't had any more failures to load. Maybe a temp goof after your fix?

joshuaatkins commented 7 years ago

@wadedwalker hopefully! Do let me know if you run into any other issues.

jediwade commented 7 years ago

@joshuaatkins Roger roger

superjoefly commented 7 years ago

I can confirm a response of {httpstatus: 200} on the "search_tweets" call mentioned above, but I haven't tested any of the other calls yet.

Great going! :-)

superjoefly commented 7 years ago

The following calls: 'statuses_update' , 'search_tweets', 'oauth_requestToken', 'statuses_homeTimeline', and 'oauth_accessToken' all are working for me.

Will update if I have any more issues...

Thanks :-)

superjoefly commented 7 years ago

I'm getting timeouts {httpstatus: 0} on all my calls again, just to let you know. Making changes to the infrastructure again?

EDIT: It's working again :-)