Twitter mentions_timeline v1.1 randomly returning 502 or 401


#1

I have been developing some new services using the REST API v1.1 and have found that the mentions_timeline has been returning a high amount of seemingly random 401 or 502 HTTP responses.

We found that we can make a call to the mentions_timeline and we would get a 502, and we would send the same call right afterwards and we would receive a 200.

Naively it seems like we hitting different servers behind a load-balancer, where some of them work and some of them don’t.

Searching this forum, I have noticed that a lot of people are having the same issues. I have also tried the suggested adding of “Content-Type: application/x-www-form-urlencoded” to no avail.

Is this a known problem, and if so will it be fixed soon?

An example 502 is :

Request DefaultHttpRequest(chunked: false)
GET /1.1/statuses/mentions_timeline.json?count=200 HTTP/1.1
Host: api.twitter.com
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_consumer_key=“XXXXXXXXXXXXX”, oauth_token=“YYYYYYYYYYYYYYYYYYYYY”, oauth_signature_method=“HMAC-SHA1”, oauth_signature=“ZZZZZZZZZZZZZZZZZ”, oauth_timestamp=“1352120064”, oauth_nonce=“AAAAAAAAAAAAAAA”, oauth_version="1.0"
Accept-Encoding: gzip
Connection: keep-alive
Accept: /
User-Agent: FOO

Response DefaultHttpResponse(chunked: false)
HTTP/1.1 502 Bad Gateway
Date: Mon, 05 Nov 2012 12:54:25 GMT
Set-Cookie: k=10.35.55.137.1352120070732337; path=/; expires=Mon, 12-Nov-12 12:54:25 GMT; domain=.twitter.com
Last-Modified: Fri, 26 Oct 2012 17:57:21 GMT
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
Server: tfe
Content-Encoding: identity
Content-Length: 9793

And example 401 :

401 Unauthorized, body={“errors”:[{“message”:“Could not authenticate you”,“code”:32}]},