# Twitter client error: Gateway Timeout

**URL:** <https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569>\
**Category:** Logstash\
**Created:** [September 6, 2018, 12:29pm UTC](https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569 "2018-09-06T12:29:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [September 6, 2018, 12:29pm UTC](https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569/1 "2018-09-06T12:29:25Z")

</div>

Hello,  
I am getting following error:

> [2018-09-06T14:26:15,801][WARN][logstash.inputs.twitter] Twitter client error {:message=\>"", :exception=\>"Twitter::Error::GatewayTimeout",  
> :backtrace=\>["/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/twitter-5.15.0/lib/twitter/streaming/response.rb:21:in `on\_headers\_complete'",  
> "org/ruby\_http\_parser/RubyHttpParser.java:370:in `\<\<'",  
> "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/twitter-5.15.0/lib/twitter/streaming/response.rb:16:in `\<\<'",  
> "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-twitter-3.0.8/lib/logstash/inputs/twitter/patches.rb:31:in `stream'",  
> "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-twitter-3.0.8/lib/logstash/inputs/twitter/patches.rb:58:in `request'",  
> "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/twitter-5.15.0/lib/twitter/streaming/client.rb:37:in `filter'",  
> "/usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/logstash-input-twitter-3.0.8/lib/logstash/inputs/twitter.rb:138:in `run'",  
> "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:408:in `inputworker'",  
> "/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:402:in `block in start\_input'"], :options=\>nil}

tcpdump snippet:

> 14:29:28.656778 Flags [P.], seq 1:2448, ack 1, win 229, options [nop,nop,TS val 3071903 ecr 3639309316], length 2447: HTTP: POST [https://stream.twitter.com/1xthe\_rest\_of\_the\_request](https://stream.twitter.com/1xthe_rest_of_the_request).  
> 14:30:07.316802 Flags [FP.], seq 1:375, ack 2448, win 32462, options [nop,nop,TS val 3859320081 ecr 3062234], length 374: HTTP: HTTP/1.1 504 Gateway Timeout

Config:

> input {  
> twitter {  
> consumer\_key =\> "XXX"  
> consumer\_secret =\> "XXX"  
> oauth\_token =\> "XXX"  
> oauth\_token\_secret =\> "XXX"  
> full\_tweet =\> true  
> ignore\_retweets =\> false  
> follows =\> ["962950647812448261","848316160"]  
> use\_samples =\> false  
> languages =\> ["en", "de"]  
> use\_proxy =\> true  
> proxy\_address =\> "172.11.54.10"  
> proxy\_port =\> "8080"  
> }  
> }
> 
> filter {}
> 
> output {  
> stdout { codec =\> dots }  
> elasticsearch {  
> hosts =\> ["localhost:9200"]  
> index =\> "twitter"  
> document\_type =\> "tweets"  
> template\_overwrite =\> true  
> template =\> "/etc/logstash/conf.d/backupconfig/twitter\_template.json"  
> }  
> }

The requests are behind a reverse proxy.  
Is there a way to increase gateway timeout?

---

<div class="post-metadata">

**Author:** ![yaauie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaauie/32/23363_2.png) [@yaauie](https://discuss.elastic.co/u/yaauie)\
**Post date:** [September 6, 2018, 8:44pm UTC](https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569/2 "2018-09-06T20:44:30Z")

</div>

The `HTTP: HTTP/1.1 504 Gateway Timeout` in your tcpdump indicates to me that your reverse proxy is severing the connection and sending the 504.

If this is the case, increasing the timeouts on your reverse proxy should improve the situation.

It is also possible that your reverse proxy is unable to establish a connection to the remote host. Checking the logs of your reverse proxy should provide hints.

---

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [September 7, 2018, 7:25am UTC](https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569/3 "2018-09-07T07:25:37Z")

</div>

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 5, 2018, 7:25am UTC](https://discuss.elastic.co/t/twitter-client-error-gateway-timeout/147569/4 "2018-10-05T07:25:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
