GET statuses/lookup returning empty string


#1

We have noticed that GET requests to /1.1/statuses/lookup.json are occasionally returning an empty string.

I added logging to the twitter-ruby gem here and we got the following output:

[Twitter::REST::Client#perform_request_with_objects] post, /1.1/statuses/lookup.json, {:id=>"621749990424227840"}, nil
[Twitter::REST::Response::ParseJson#on_complete] "", nil

Is it customary for the API to return an empty string? If so, it probably makes sense to make this apparent in the documentation and then I can work on an upstream patch for the twitter-ruby gem. The issue is causing the following exception to happen:

NoMethodError: undefined method `collect' for nil:NilClass
/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:96 in perform_request_with_objects
/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:88 in perform_post_with_objects
/gems/twitter-5.14.0/lib/twitter/rest/tweets.rb:79 in block in statuses
/gems/twitter-5.14.0/lib/twitter/utils.rb:37 in block in pmap
/gems/twitter-5.14.0/lib/twitter/utils.rb:37 in each_slice
/gems/twitter-5.14.0/lib/twitter/utils.rb:37 in each
/gems/twitter-5.14.0/lib/twitter/utils.rb:37 in collect
/gems/twitter-5.14.0/lib/twitter/utils.rb:37 in pmap
/gems/twitter-5.14.0/lib/twitter/utils.rb:25 in flat_pmap
/gems/twitter-5.14.0/lib/twitter/rest/tweets.rb:78 in statuses

If it is not customary for this to happen, then I am happy to provide additional details to help debug this issue on your side.

Thanks,

Henry Hsu
Zendesk | Engineering Manager | Team Fortress


#2

Seems pretty weird. I’ve just tried using twurl to retrieve that same Tweet and the full JSON object is returned as expected. I wouldn’t expect that call to return an empty string, even if there was a problem.

Has this started happening recently, at a point in time, or over a period or days / weeks?
Are you seeing any HTTP or API response codes?


#3

We have been getting the same on users/show for about 48 hours now. Status Code is 404 when there is no response. Subsequent identical queries yield a response, it seems very sporadic.


#4

This might be related: Intermittent 404 responses from REST API
We get intermittent 404 (FileNotFoundException from Twitter4J) since july 16th, around 1am (UTC).
Thanks.


#5

I did some digging and I don’t believe we’re receiving 404’s. We’re using the twitter ruby gem and it would have raised a Twitter::Error::NotFound if we received a 404.

I will add additional logging to figure out what status code we’re receiving.