smswithoutborders/SMSWithoutBorders-Gateway-Client

Unable to get sms inbox for each modem

Closed this issue · 8 comments

GET /modems/<index>/sms fails with a 500

GET /modems/.org.freedesktop.ModemManager1.Modem.9/sms HTTP/1.1" 500

fixed now: 129444d

@sherlockwisdom this issue has resurfaced.

Not sure what the exact problem is but this comes up regularly in the jounalctl logs

Oct 12 00:17:13 Dytrrr python3[373536]: ERROR:pika.adapters.blocking_connection:Connection workflow failed: AMQPConnectionWorkflowFailed: 1 exceptions in all; last exception - AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connection refused'); first exception - None
Oct 12 00:17:13 Dytrrr python3[373536]: ERROR:pika.adapters.blocking_connection:Error in _create_connection().
Oct 12 00:17:13 Dytrrr python3[373536]: Traceback (most recent call last):
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/venv/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
Oct 12 00:17:13 Dytrrr python3[373536]:     raise self._reap_last_connection_workflow_error(error)
Oct 12 00:17:13 Dytrrr python3[373536]: pika.exceptions.AMQPConnectionError
Oct 12 00:17:13 Dytrrr python3[373536]: ERROR:root:
Oct 12 00:17:13 Dytrrr python3[373536]: Traceback (most recent call last):
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/outbound.py", line 125, in rmq_connection
Oct 12 00:17:13 Dytrrr python3[373536]:     self.__rmq_connection__()
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/outbound.py", line 113, in __rmq_connection__
Oct 12 00:17:13 Dytrrr python3[373536]:     raise error
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/outbound.py", line 100, in __rmq_connection__
Oct 12 00:17:13 Dytrrr python3[373536]:     self.outgoing_connection, self.outgoing_channel = RabbitMQBroker.create_channel(
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/rabbitmq_broker.py", line 63, in create_channel
Oct 12 00:17:13 Dytrrr python3[373536]:     raise error
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/rabbitmq_broker.py", line 44, in create_channel
Oct 12 00:17:13 Dytrrr python3[373536]:     connection=pika.BlockingConnection(parameters=parameters)
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/venv/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 360, in __init__
Oct 12 00:17:13 Dytrrr python3[373536]:     self._impl = self._create_connection(parameters, _impl_class)
Oct 12 00:17:13 Dytrrr python3[373536]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/venv/lib/python3.8/site-packages/pika/adapters/blocking_connection.py", line 451, in _create_connection
Oct 12 00:17:13 Dytrrr python3[373536]:     raise self._reap_last_connection_workflow_error(error)
Oct 12 00:17:13 Dytrrr python3[373536]: pika.exceptions.AMQPConnectionError
Oct 12 00:17:13 Dytrrr python3[373536]: DEBUG:root:End AMP connection for outbound...
Oct 12 00:17:13 Dytrrr python3[373536]: DEBUG:root:[/org/freedesktop/ModemManager1/Modem/11] starting rabbitmq connection...
Oct 12 00:17:13 Dytrrr python3[373536]: DEBUG:root:modem operator code: 62401
Oct 12 00:17:13 Dytrrr python3[373530]: ERROR:pika.adapters.utils.io_services_utils:Socket failed to connect: <socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 56518)>; error=111 (Connection refused)
Oct 12 00:17:13 Dytrrr python3[373536]: DEBUG:root:modem operator name: MTN Cameroon

Cannot currently replicate issue. If issue is the above screenshot, it's not related to the API - that's an issue with connection to RabbitMQ

@nSedrickm what is the state of this issue, does the API provide the required output? If yes I think we can close this and reopen another for the above issue

@sherlockwisdom it seems to be related to RabbitMQ. I am not sure how gateway client and RabbitMQ are linked/setup. I thought it was only needed for OpenAPI

Gateway clients connect to openapi (which runs rabbitmq server) for outbound messages

@PromiseFru helped pull this out from the logs. The messages table is missing

Oct 12 10:44:13 Dytrrr python3[492933]: Traceback (most recent call last):
Oct 12 10:44:13 Dytrrr python3[492933]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/api.py", line 148, in api_fetch_incoming_sms
Oct 12 10:44:13 Dytrrr python3[492933]:     messages = get_messages(index, 'incoming')
Oct 12 10:44:13 Dytrrr python3[492933]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/api.py", line 230, in get_messages
Oct 12 10:44:13 Dytrrr python3[492933]:     raise error
Oct 12 10:44:13 Dytrrr python3[492933]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/api.py", line 224, in get_messages
Oct 12 10:44:13 Dytrrr python3[492933]:     stored_messages = MessageStore().load(
Oct 12 10:44:13 Dytrrr python3[492933]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/message_store.py", line 135, in load
Oct 12 10:44:13 Dytrrr python3[492933]:     raise error
Oct 12 10:44:13 Dytrrr python3[492933]:   File "/home/nsedrickm/Documents/SMSwithoutborders/SMSWithoutBorders-Gateway-Client/src/message_store.py", line 111, in load
Oct 12 10:44:13 Dytrrr python3[492933]:     cur.execute('''SELECT
Oct 12 10:44:13 Dytrrr python3[492933]: sqlite3.OperationalError: no such table: messages
Oct 12 10:44:13 Dytrrr python3[492933]: INFO:werkzeug:127.0.0.1 - - [12/Oct/2022 10:44:13] "GET /modems/.org.freedesktop.ModemManager1.Modem.14/sms HTTP/1.1"