Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ошибка при инициализации бота через webhook #77

Open
yakhlakov opened this issue May 15, 2018 · 13 comments
Assignees

Comments

@yakhlakov
Copy link

Добрый день.

Окружение:
Redmine version 3.4.4.stable
Ruby version 2.3.4-p301 (2017-03-30) [x86_64-linux]
Rails version 4.2.8
Environment production
Database adapter Mysql2

Обновился до версии 0.7.2. Авторизация прошла успешно.
При попытке инициализировать бота через webhook сервер возвращает 500 ошибку. getupdates - аналогичная проблема.
Сообщение об ошибке в логах - Faraday::ConnectionFailed (end of file reached).

Инициализация через api.telegram.org проходит успешно {"ok":true,"result":true,"description":"Webhook was set"}.

Подскажите, в чем может быть проблема? Правильно ли будет установить webhook так:
https://api.telegram.org/bot_token/setWebhook?url=https://host_name/telegram/api/web_hook

@vladislav-yashin
Copy link
Contributor

Добрый день. Провайдер точно не блокирует api.telegram.org?

@yakhlakov
Copy link
Author

Провайдер блокирует, но я выполняю запросы через VPN

@vladislav-yashin
Copy link
Contributor

Возможно, Net::Http не дружит с VPN. Есть возможность попробовать отключить VPN и добавить прокси в настройках плагина?

@yakhlakov
Copy link
Author

yakhlakov commented May 15, 2018

Пробовал и через прокси без VPN-аналогичная ситуация.

https://api.telegram.org/bot_token/getWebhookInfo возвращает
{"ok":true,"result":{"url":"https://host_name/telegram/api/web_hook","has_custom_certificate":false,"pending_update_count":7,"last_error_date":1526387259,"last_error_message":"Connection timed out","max_connections":40}}

@pr0l
Copy link

pr0l commented May 15, 2018

[ 4][t 4][1526388167.762759924][FileDb.h:58][!GetMeRequest] GET [profile_photos, DcId{2}, location = [id = 3099******02435258, access_hash = 0, volume_id = ***830640, secret = 5326451851835******, local_id = 90279]] [Error : 0 : There is no such a key in db]]

у меня отсюда ошибки начинаются, может есть идеи что тут должно быть?

@vladislav-yashin
Copy link
Contributor

Похоже, что проблема на стороне telegram. Причем проявляется только для некоторых ботов (у нас с одним токеном работает, а с другим - ошибка).

@yakhlakov
Copy link
Author

Пробовал повесить хук на боты с другими токенами-та же беда.
И все-таки, возможно ли обойти через http запрос к api? (https://api.telegram.org/bot_token/setWebhook?url=https://host_name/telegram/api/web_hook)

@vladislav-yashin
Copy link
Contributor

vladislav-yashin commented May 16, 2018

И все-таки, возможно ли обойти через http запрос к api? (https://api.telegram.org/bot_token/setWebhook?url=https://host_name/telegram/api/web_hook)

Внутри плагина он так и устанавливается

Если откатиться до предыдущей версии, проблема сохраняется?

@yakhlakov
Copy link
Author

yakhlakov commented May 16, 2018

с версией 0.7.1 проблема сохраняется

upd: в более старых версиях с инициализацией в плагине redmine_intouch проблема сохраняется.

@raggajah
Copy link

raggajah commented May 28, 2018

Добрый день, +1 аналогичная проблема

[ 3][t 4][1527508878.058313370][Td.cpp:4648][!Td][&td_requests] Sending result for request 4: user {
  id = 423580524
  first_name = "Aleksandr"
  last_name = ""
  username = ""
  phone_number = "79857572577"
  status = userStatusOffline {
    was_online = 1527497133
  }
  profile_photo = null
  outgoing_link = linkStateKnowsPhoneNumber {
  }
  incoming_link = linkStateKnowsPhoneNumber {
  }
  is_verified = false
  restriction_reason = ""
  have_access = true
  type = userTypeRegular {
  }
  language_code = ""
}

[ 2][t 4][1527508878.058592558][Td.cpp:4368][!Td]       Close [destroy:false]
[ 3][t 4][1527508878.058609009][Td.cpp:4633][!Td][&td_requests] Sending update: updateAuthorizationState {
  authorization_state = authorizationStateClosing {
  }
}

[ 2][t 4][1527508878.058615685][Td.cpp:4237][!Td]       no request actors
[ 4][t 4][1527508878.058619499][Td.cpp:4262][!Td]       Options was cleared in 0.000002
[ 4][t 4][1527508878.058623791][Td.cpp:4266][!Td]       Handlers was cleared in 0.000006
[ 4][t 4][1527508878.058632135][Session.cpp:291][!Session:2:main]       HANGUP
[ 3][t 4][1527508878.058636427][NetQuery.h:306][!Session:2:main][&net_query]    Got error [Query:[id:65536][tl:0xedd4882a][state:Query]] [Error : 202 : ]
[ 3][t 4][1527508878.058640718][NetQuery.h:245][!Session:2:main][&net_query]    [Query:[id:65536][tl:0xedd4882a][state:Error][Error : 202 : ]] [debug:dispatch]
[ 3][t 4][1527508878.058648825][NetQuery.h:306][!Session:2:main][&net_query]    Got error [Query:[id:65536][tl:0xedd4882a][state:Error][Error : 202 : ]] [Error : 500 : Internal Server Error: closing]
[ 3][t 4][1527508878.058653831][NetQuery.h:306][!Session:2:main][&net_query]    Got error [Query:[id:131072][tl:0xc4f9186b][state:Query]] [Error : 202 : ]
[ 3][t 4][1527508878.058657169][NetQuery.h:245][!Session:2:main][&net_query]    [Query:[id:131072][tl:0xc4f9186b][state:Error][Error : 202 : ]] [debug:dispatch]
[ 3][t 4][1527508878.058660030][NetQuery.h:306][!Session:2:main][&net_query]    Got error [Query:[id:131072][tl:0xc4f9186b][state:Error][Error : 202 : ]] [Error : 500 : Internal Server Error: closing]
[ 4][t 4][1527508878.058681726][Td.cpp:4268][!Td]       NetQueryDispatcher was stopped in 0.000065
[ 3][t 4][1527508878.058688402][TopDialogManager.cpp:268][!TopDialogManager]    Send get top peers request
[ 4][t 4][1527508878.058691502][utils.cpp:21][!TopDialogManager]        Create storer for contacts_getTopPeers {
  flags = 33807
  offset = 0
  limit = 100
  hash = 0
}

[ 3][t 4][1527508878.058698654][NetQuery.h:351][!TopDialogManager]      [Query:[id:196608][tl:0xd4982db5][state:Query]]
[ 3][t 4][1527508878.058702230][NetQuery.h:245][!TopDialogManager][&net_query]  [Query:[id:196608][tl:0xd4982db5][state:Query]] [debug:dispatch]
[ 3][t 4][1527508878.058705091][NetQuery.h:306][!TopDialogManager][&net_query]  Got error [Query:[id:196608][tl:0xd4982db5][state:Query]] [Error : 500 : Internal Server Error: closing]
[ 3][t 4][1527508878.058708668][TopDialogManager.cpp:463][!TopDialogManager]    Wakeup: never
[ 4][t 4][1527508878.058712721][Td.cpp:4270][!Td]       StateManager was cleared in 0.000095
[ 4][t 4][1527508878.058717728][Timeout.cpp:53][!Td]    Cancel timeout for -1
[ 4][t 4][1527508878.058720589][Td.cpp:4290][!Td]       Requests was answered in 0.000103
[ 4][t 4][1527508878.058725357][Td.cpp:4294][!Td]       CallManager was cleared in 0.000108
[ 4][t 4][1527508878.058729649][Td.cpp:4296][!Td]       ConfigManager was cleared in 0.000112
[ 4][t 4][1527508878.058733702][Td.cpp:4298][!Td]       DeviceTokenManager was cleared in 0.000116
[ 4][t 4][1527508878.058739185][Td.cpp:4300][!Td]       HashtagHints was cleared in 0.000122
[ 4][t 4][1527508878.058745623][Td.cpp:4302][!Td]       NetStatsManager was cleared in 0.000128
[ 4][t 4][1527508878.058750629][Td.cpp:4304][!Td]       PasswordManager was cleared in 0.000133
[ 4][t 4][1527508878.058754921][Td.cpp:4306][!Td]       PrivacyManager was cleared in 0.000137
[ 4][t 4][1527508878.058759451][Td.cpp:4308][!Td]       SecretChatsManager was cleared in 0.000142
[ 4][t 4][1527508878.058764458][Td.cpp:4310][!Td]       StorageManager was cleared in 0.000147
[ 4][t 4][1527508878.058768749][Td.cpp:4312][!Td]       TopDialogManager was cleared in 0.000151
[ 4][t 4][1527508878.058773279][Socks5.cpp:31][!Socks5][&socks5]        Receive [Error : 0 : Cancelled]
[ 4][t 4][1527508878.058780193][Socks5.cpp:40][!Socks5][&socks5]        Finish to connect to proxy
[ 4][t 4][1527508878.058795929][Td.cpp:4315][!Td]       ConnectionCreator was cleared in 0.000179
[ 4][t 4][1527508878.058800936][Td.cpp:4319][!Td]       AnimationsManager actor was cleared in 0.000183
[ 4][t 4][1527508878.058804989][Td.cpp:4321][!Td]       AuthManager actor was cleared in 0.000187
[ 4][t 4][1527508878.058808327][Td.cpp:4323][!Td]       ChangePhoneNumberManager actor was cleared in 0.000191
[ 4][t 4][1527508878.058812141][Td.cpp:4325][!Td]       ContactsManager actor was cleared in 0.000195
[ 4][t 4][1527508878.058816910][Td.cpp:4327][!Td]       FileManager actor was cleared in 0.000199
[ 4][t 4][1527508878.058821201][Td.cpp:4329][!Td]       InlineQueriesManager actor was cleared in 0.000203
[ 4][t 4][1527508878.058825493][Td.cpp:4331][!Td]       MessagesManager actor was cleared in 0.000208
[ 4][t 4][1527508878.058829546][Td.cpp:4333][!Td]       StickersManager actor was cleared in 0.000212
[ 4][t 4][1527508878.058833838][Td.cpp:4335][!Td]       UpdatesManager actor was cleared in 0.000216
[ 4][t 4][1527508878.058837175][Td.cpp:4337][!Td]       WebPagesManager actor was cleared in 0.000219
[ 3][t 1][1527508878.058971882][MessagesDb.cpp:950][!MessagesDbActor]   MessagesDb flushed
[ 2][t 4][1527508878.059017420][Td.cpp:4165][!Td]       ON_ACTORS_CLOSED
[ 4][t 4][1527508878.059025049][Td.cpp:4168][!Td]       AnimationsManager was cleared in 0.000004
[ 4][t 4][1527508878.059028864][Td.cpp:4170][!Td]       AudiosManager was cleared in 0.000007
[ 4][t 4][1527508878.059032440][Td.cpp:4172][!Td]       AuthManager was cleared in 0.000011
[ 4][t 4][1527508878.059035778][Td.cpp:4174][!Td]       ChangePhoneNumberManager was cleared in 0.000014
[ 4][t 4][1527508878.059047699][Td.cpp:4176][!Td]       ContactsManager was cleared in 0.000026
[ 4][t 4][1527508878.059051037][Td.cpp:4178][!Td]       DocumentsManager was cleared in 0.000029
[ 4][t 4][1527508878.059056759][Td.cpp:4180][!Td]       FileManager was cleared in 0.000035
[ 4][t 4][1527508878.059060574][Td.cpp:4182][!Td]       InlineQueriesManager was cleared in 0.000039
[ 4][t 4][1527508878.059073925][Td.cpp:4184][!Td]       MessagesManager was cleared in 0.000052
[ 4][t 4][1527508878.059082747][Td.cpp:4186][!Td]       StickersManager was cleared in 0.000061
[ 4][t 4][1527508878.059087753][Td.cpp:4188][!Td]       UpdatesManager was cleared in 0.000066
[ 4][t 4][1527508878.059090853][Td.cpp:4190][!Td]       VideoNotesManager was cleared in 0.000069
[ 4][t 4][1527508878.059093714][Td.cpp:4192][!Td]       VideosManager was cleared in 0.000072
[ 4][t 4][1527508878.059096336][Td.cpp:4194][!Td]       VoiceNotesManager was cleared in 0.000075
[ 4][t 4][1527508878.059100866][Td.cpp:4196][!Td]       WebPagesManager was cleared in 0.000079
[ 3][t 1][1527508878.059173822][FileDb.cpp:68][!FileDbActor]    FileDb is closed
[ 3][t 1][1527508878.059258461][ConcurrentBinlog.cpp:24][!Binlog /var/www/redmine/tmp/redmine_telegram_common/tdlib/db/td.binlog]       close: done
[ 3][t 4][1527508878.059296370][SqliteConnectionSafe.h:39][!MultiPromise]       Close sqlite db [path:/var/www/redmine/tmp/redmine_telegram_common/tdlib/db/db.sqlite]
[ 2][t 4][1527508878.059444666][Td.cpp:4215][!Td]       ON_CLOSED
[ 3][t 4][1527508878.059452057][Td.cpp:4633][!Td][&td_requests] Sending update: updateAuthorizationState {
  authorization_state = authorizationStateClosed {
  }
}

rake aborted!
Faraday::ConnectionFailed: end of file reached

EOFError: end of file reached

Tasks: TOP => telegram_common:bot

redmine находится за обратным прокси nginx , из интернета работает. сам плагин настроен через собственный SOCKS5 прокси.
помогите, пожалуйста, разобраться, в чем может быть проблема..

@vladislav-yashin
Copy link
Contributor

сам плагин настроен через собственный SOCKS5 прокси

SOCKS5 прокси установлен для tdlib или для бота? Бот на текущий момент может работать только с http-прокси.

@raggajah
Copy link

да, через http прокси законектился, спасибо!

@yakhlakov
Copy link
Author

Есть такой момент.
Если использовать VPN на хосте, вне зависимости от настроек tdlib proxy и bot proxy, при сбросе кэша, авторизации и инициализации бота через getupdates бот работает.
Как думаете, в чем может быть проблема?
Лог примерно такой:

[ 4][t 2][1528296157.274627686][Session.cpp:291][!Session:2:main]	HANGUP
[ 3][t 2][1528296157.274663925][Session.cpp:386][!Session:2:main]	on_closed: OK Session:2:main::Connect::Tcp::[149.154.167.51:443] DcId{2}[172.18.12.110:41872]
[ 3][t 2][1528296157.274676323][Session.cpp:571][!Session:2:main][&net_query]	Mark as unknown [msg_id:6563982011259145372][Query:[id:262144][tl:0xedd4882a][state:Query]]
[ 3][t 2][1528296157.274690151][Session.cpp:571][!Session:2:main][&net_query]	Mark as unknown [msg_id:6563982011259152532][Query:[id:327680][tl:0xc4f9186b][state:Query]]
[ 3][t 2][1528296157.274707079][NetQuery.h:306][!Session:2:main][&net_query]	Got error [Query:[id:262144][tl:0xedd4882a][state:Query]] [Error : 202 : ]
[ 3][t 2][1528296157.274719000][NetQuery.h:245][!Session:2:main][&net_query]	[Query:[id:262144][tl:0xedd4882a][state:Error][Error : 202 : ]] [debug:dispatch]
[ 3][t 2][1528296157.274730682][NetQuery.h:306][!Session:2:main][&net_query]	Got error [Query:[id:262144][tl:0xedd4882a][state:Error][Error : 202 : ]] [Error : 500 : Internal Server Error: closing]
[ 3][t 2][1528296157.274743080][NetQuery.h:306][!Session:2:main][&net_query]	Got error [Query:[id:327680][tl:0xc4f9186b][state:Query]] [Error : 202 : ]
[ 3][t 2][1528296157.274752855][NetQuery.h:245][!Session:2:main][&net_query]	[Query:[id:327680][tl:0xc4f9186b][state:Error][Error : 202 : ]] [debug:dispatch]
[ 3][t 2][1528296157.274762392][NetQuery.h:306][!Session:2:main][&net_query]	Got error [Query:[id:327680][tl:0xc4f9186b][state:Error][Error : 202 : ]] [Error : 500 : Internal Server Error: closing]
[ 4][t 2][1528296157.276995897][Td.cpp:4268][!Td]	NetQueryDispatcher was stopped in 0.002434
[ 3][t 2][1528296157.277038574][TopDialogManager.cpp:268][!TopDialogManager]	Send get top peers request
[ 4][t 2][1528296157.277057409][utils.cpp:21][!TopDialogManager]	Create storer for contacts_getTopPeers {
  flags = 33807
  offset = 0
  limit = 100
  hash = 0
}

[ 3][t 2][1528296157.277081728][NetQuery.h:351][!TopDialogManager]	[Query:[id:393216][tl:0xd4982db5][state:Query]]
[ 3][t 2][1528296157.277095079][NetQuery.h:245][!TopDialogManager][&net_query]	[Query:[id:393216][tl:0xd4982db5][state:Query]] [debug:dispatch]
[ 3][t 2][1528296157.277105093][NetQuery.h:306][!TopDialogManager][&net_query]	Got error [Query:[id:393216][tl:0xd4982db5][state:Query]] [Error : 500 : Internal Server Error: closing]
[ 3][t 2][1528296157.277117252][TopDialogManager.cpp:463][!TopDialogManager]	Wakeup: never
[ 4][t 2][1528296157.277130365][Td.cpp:4270][!Td]	StateManager was cleared in 0.002556
[ 4][t 2][1528296157.277141333][Timeout.cpp:53][!Td]	Cancel timeout for -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants