telegram-bot-rb / telegram_bot_app

Example Rails 5 Telegram bot app
97 stars 36 forks source link

Cant set my webhook at production. HTTPClient::ConnectTimeoutError: #23

Closed Nmerey closed 4 years ago

Nmerey commented 4 years ago

I have updated my secrets.yml and uncommented routes.default_url_options = {host: 'f77a57b14aff.ngrok.io', protocol: 'https'} in prodcution

Setting webhook for default...
rake aborted!
HTTPClient::ConnectTimeoutError: execution expired
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `initialize'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `new'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `create_socket'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:21:in `create_socket'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:752:in `block in connect'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/httpclient-2.8.3/lib/httpclient.rb:765:in `post'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/telegram/bot/client.rb:71:in `http_request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/telegram/bot/client.rb:62:in `request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/telegram/bot/async.rb:151:in `request'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/telegram/bot/client/api_helper.rb:22:in `block (2 levels) in define_helpers'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/tasks/telegram-bot.rake:24:in `block (5 levels) in <top (required)>'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/telegram/bot/async.rb:138:in `async'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/tasks/telegram-bot.rake:24:in `block (4 levels) in <top (required)>'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/tasks/telegram-bot.rake:20:in `each'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bundler/gems/telegram-bot-da31cd148aa8/lib/tasks/telegram-bot.rake:20:in `block (3 levels) in <top (required)>'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `eval'
/Users/mereynurlan/.rvm/gems/ruby-2.6.3/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => telegram:bot:set_webhook
printercu commented 4 years ago

Does curl https://api.telegram.org/ work from that server?

Nmerey commented 4 years ago

Yes, I have set it manually and it is connected to my local server but it does not respont in telegram bot.

[ActiveJob] Enqueued Telegram::Bot::Client::AsyncJob (Job ID: 2f8edbff-25c1-42f9-add1-abe8511c5e62) to Async(default) with arguments: "default", "sendMessage", {:text=>"You wrote: something", :chat_id=>231273192}
Responded with message
Completed in 1ms (ActiveRecord: 0.0ms)

Снимок экрана 2020-06-07 в 20 33 15

Nmerey commented 4 years ago
MacBook-Air-Merey% rails c
Running via Spring preloader in process 70700
Loading development environment (Rails 5.0.6)
[1] telegram_bot_app »  Telegram.bot.get_webhook_info
Enqueued Telegram::Bot::Client::AsyncJob (Job ID: 714ad79a-1733-4294-9a99-49f19a5169a1) to Async(default) with arguments: "default", "getWebhookInfo", {}
Performing Telegram::Bot::Client::AsyncJob from Async(default) with arguments: "default", "getWebhookInfo", {}
=> #<Telegram::Bot::Client::AsyncJob:0x00007f86d8d895a8 @arguments=["default", "getWebhookInfo", {}], @job_id="714ad79a-1733-4294-9a99-49f19a5169a1", @queue_name="default", @priority=nil, @provider_job_id="0f191a41-20b7-4b30-a686-0676ee83104e">
Nmerey commented 4 years ago

Does curl https://api.telegram.org/ work from that server?

Yeah sorry for not checking earlier! It is actually because I use vpn on browser to manually connect and on terminal it does not load.

How do I bypass that?

Nmerey commented 4 years ago

Thanks for suggestion! otherwise I would have spent so much time on it!