Telegram Integration Error

Hello,

I’ve followed the Telegram channel guide to create the channel. As of late, I’ve been getting this error every time I try to start the rasa server with the telegram credentials in the credentials.yml file.

(cbot) E:\iplbot\init_dir>rasa run
2019-11-15 12:22:47.509145: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2019-11-15 12:22:47.512989: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2019-11-15 12:22:50 INFO     engineio.server  - Server initialized for sanic.
Traceback (most recent call last):
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 360, in _make_request
    self._validate_conn(conn)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 857, in _validate_conn
    super(HTTPSConnectionPool, self)._validate_conn(conn)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 289, in _validate_conn
    conn.connect()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connection.py", line 326, in connect
    ssl_context=context)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\util\ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 817, in __init__
    self.do_handshake()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\utils\request.py", line 203, in _request_wrapper
    resp = self._con_pool.request(*args, **kwargs)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\request.py", line 70, in request
    **urlopen_kw)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\request.py", line 148, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\poolmanager.py", line 244, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 666, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\util\retry.py", line 347, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 617, in urlopen
    chunked=chunked)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 360, in _make_request
    self._validate_conn(conn)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 857, in _validate_conn
    super(HTTPSConnectionPool, self)._validate_conn(conn)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connectionpool.py", line 289, in _validate_conn
    conn.connect()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\connection.py", line 326, in connect
    ssl_context=context)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\util\ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 407, in wrap_socket
    _context=self, _session=session)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 817, in __init__
    self.do_handshake()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 1077, in do_handshake
    self._sslobj.do_handshake()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\ssl.py", line 689, in do_handshake
    self._sslobj.do_handshake()
telegram.vendor.ptb_urllib3.urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Softwares\Anaconda\Anaconda3\envs\cbot\Scripts\rasa.exe\__main__.py", line 7, in <module>
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\__main__.py", line 76, in main
    cmdline_arguments.func(cmdline_arguments)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\cli\run.py", line 114, in run
    rasa.run(**vars(args))
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\run.py", line 56, in run
    **kwargs,
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\run.py", line 172, in serve_application
    log_file=log_file,
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\run.py", line 107, in configure_app
    channels.channel.register(input_channels, app, route=route)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\channel.py", line 89, in register
    app.blueprint(channel.blueprint(handler), url_prefix=p)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\telegram.py", line 185, in blueprint
    out_channel = self.get_output_channel()
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\rasa\core\channels\telegram.py", line 268, in get_output_channel
    channel.setWebhook(self.webhook_url)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\bot.py", line 65, in decorator
    result = func(self, *args, **kwargs)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\bot.py", line 2070, in set_webhook
    result = self._request.post(url_, data, timeout=timeout)
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\utils\request.py", line 309, in post
    headers={'Content-Type': 'application/json'})
  File "d:\softwares\anaconda\anaconda3\envs\cbot\lib\site-packages\telegram\utils\request.py", line 209, in _request_wrapper
    raise NetworkError('urllib3 HTTPError {0}'.format(error))
telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

I have used Ngrok to host my local server.

Hey @GauravRoy48 do you mind showing me the example of the credentials.yml file just so I can confirm how you have that set.

Sure.

# This file contains the credentials for the voice & chat platforms
# which your bot is using.
# https://rasa.com/docs/rasa/user-guide/messaging-and-voice-channels/

rest:
#  # you don't need to provide anything here - this channel doesn't
#  # require any credentials


#facebook:
#  verify: "<verify>"
#  secret: "<your secret>"
#  page-access-token: "<your page access token>"

#slack:
#  slack_token: "<your slack token>"
#  slack_channel: "<the slack channel>"

#socketio:
#  user_message_evt: <event name for user message>
#  bot_message_evt: <event name for but messages>
#  session_persistence: <true/false>

telegram:
  access_token: "844482989:AAEwCtcuwObHTa-7_L1Zrb4xIXXXXXXXXXX"
  verify: "test_0408_bot"
  webhook_url: "https://dbf597e8.ngrok.io/webhooks/telegram/webhook"

rasa:
  url: "http://localhost:5002/api"

Ok that looks fine, and I’m assuming you have ngrok obviously running and everything in a separate window, etc right?

Yes. It used to work before but as of late it hasn’t been working. Could a Windows update have broken something?

Possibly? I tried it recently on my macbook for another forum user question and the telegram channel was fine then.

The WinError 10054 means basically that there was already an active connection I believe so do you have anything running in the background accidently maybe?

Check windows process explorer maybe?

I’ll give it a shot. But I don’t think that’s an issue because my socketIO channel is working fine.

Hi is it resolved?

Nope

I’m not running on windows but I know I recently used the telegram channel fine locally for testing on my macbook fine for what its worth.

It seems to be working now.