VictorNine / fbridge

Bridge facebook messenger with any service supported by matterbridge
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

[noob issue] Bridge doesn't seem to work #5

Closed jakubiakdev closed 4 years ago

jakubiakdev commented 4 years ago

I don't exactly know how does it all work, but I still tried to configure it. After running python3 fbridge.py it gives me a number of errors.

Login of mymail@mymail successful.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 181, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xb5ad87f0>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=4242): Max retries exceeded with url: /api/messages (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xb5ad87f0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "fbridge.py", line 50, in listen
    r = requests.get('http://localhost:4242/api/messages')
  File "/usr/lib/python3/dist-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4242): Max retries exceeded with url: /api/messages (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0xb5ad87f0>: Failed to establish a new connection: [Errno 111] Connection refused'))

Listening...

Additionally when someone types something I get information for it in the terminal. Also output of matterbridge

[0000]  INFO main:         [setupLogger:matterbridge.go:97] Enabling debug logging.
[0000]  INFO main:         [main:matterbridge.go:46] Running version 1.17.5 8eb5e3cb
[0000]  INFO router:       [Start:gateway/router.go:66] Parsing gateway fbbridge //maybe there's the issue?
[0000]  INFO router:       [Start:gateway/router.go:75] Starting bridge: telegram.mytelegram 
[0000]  INFO telegram:     [Connect:bridge/telegram/telegram.go:32] Connecting
[0000]  INFO telegram:     [Connect:bridge/telegram/telegram.go:45] Connection succeeded
[0000]  INFO telegram:     [joinChannels:bridge/bridge.go:77] telegram.mytelegram: joining 866432893 (ID: 866432893telegram.mytelegram)
[0000]  INFO main:         [main:matterbridge.go:61] Gateway(s) started succesfully. Now relaying messages

my matterbridge.toml

[telegram.mytelegram]
#See https://core.telegram.org/bots#6-botfather 
#and https://www.linkedin.com/pulse/telegram-bots-beginners-marco-frau
Token="this seems to be correct"
RemoteNickFormat="<{NICK}>"

[[gateway]]
name="fbbridge"
enable=true

[[gateway.inout]]
account="telegram.mytelegram"
channel="this seems to be correct"

Also I don't know if I should make an issue on matterbridge repo

elixx commented 4 years ago

Your matterbridge config needs an 'api' section. This opens the port that fbridge connects to.

jakubiakdev commented 4 years ago

Yep, that was the problem. I did an oopsie by thinking api.myapi was a placeholder.