Closed dvodvo closed 2 years ago
+1 some by get webhook
2022-03-10 20-12-27.047] [ActiveJob] [Telegram::Bot::Client::AsyncJob] [00235614-1ea9-40fa-ab4b-53106aec141a] Error performing Telegram::Bot::Client::AsyncJob (Job ID: 00235614-1ea9-40 fa-ab4b-53106aec141a) from Async(default) in 238.43ms: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired)): /home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:103:in
connect'
/home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:103:in ssl_connect' /home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:41:in
initialize'
/home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:26:in new' /home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:26:in
create_socket'
/home/deploy/tgbot/shared/bundle/ruby/2.6.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:752:in block in connect' /home/deploy/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/timeout.rb:93:in
block in timeout'
`
Do you use self-signed cert? Do you provide it with CERT option?
See more details in https://github.com/telegram-bot-rb/telegram-bot/wiki/Deployment#webhooks
Hello,
No, I am not using a self-signed cert, but one issued via lets encrypt.
On Sat, Mar 12, 2022, at 19:30, Max Melentiev wrote:
Do you use self-signed cert? Do you provide it with CERT option?
See more details in https://github.com/telegram-bot-rb/telegram-bot/wiki/Deployment#webhooks
— Reply to this email directly, view it on GitHub https://github.com/telegram-bot-rb/telegram-bot/issues/178#issuecomment-1065937538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFO2YTFCRGRWNE23PDDCGLU7TPF3ANCNFSM5PG4S5MQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>
Could you please share a host name of the server you use for a webhook url?
I had faced exactly the same issues, but on digging deeper, for me the issue was on https://github.com/telegram-bot-rb/telegram-bot/blob/master/lib/telegram/bot/client.rb#L58
def initialize(token = nil, username = nil, server: SERVER, **options)
@client = HTTPClient.new
@token = token || options[:token]
@username = username || options[:username]
@base_uri = format(URL_TEMPLATE, server: server, token: self.token)
end
Here instead of getting the constant SERVER
defined on the file, the argument is being overwritten by my bot server URL from the config. not sure why this is happening, but the way i fixed this was by simply changing base_uri format to
@base_uri = format(URL_TEMPLATE, server: SERVER, token: self.token)
in order to pick from the constant instead of a variable argument. This should be fine as the telegram host would never change either.
Apologies, the above comment was because of a misunderstanding...
Simply removing the server
config from my bot configs resolved my issue
bundle exec rake telegram:bot:set_webhook RAILS_ENV=development
will fail with gem version 0.15.4, rails 6.1.3.2, ruby 2.6.1In examining the stack trace, there are two obvious break points to examine and get object information, the first in each of these blocks:
In intercepting
lib/telegram/bot/client.rb:73
the following were being generated for uri and body and leading to errorOpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (certificate has expired)
:The uri has the curiosity of having a double slash.
The body is quite telling (I believe one issue is that it states the certificate as nil) as if the gem is looking for a client authentication certificate. Now here is the kicker: using the API directly
sets the webhook appropriately! The Telegram server does the cert check and its validation passes.
All other actions, such as
respond_with :message
hit the same(certificate has expired)
error presumably for the same motive.Having another application on another server, older gem version 0.14.4, this does not occur.
side note This may be pertinent.. I never managed to start the server with the indications of syntax for the controller:
class Telegram::WebhookController < Telegram::Bot::UpdatesController
but had to use, as per the example appclass TelegramWebhooksController < Telegram::Bot::UpdatesController
with routes set astelegram_webhook TelegramWebhooksController