praekeltfoundation / vumi

Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.
BSD 3-Clause "New" or "Revised" License
421 stars 131 forks source link

TypeError in vumi/utils.py #1077

Closed seidu626 closed 4 years ago

seidu626 commented 4 years ago

2020-01-06T08:07:24+0000 [twisted.internet.defer#critical] Unhandled error in Deferred: 2020-01-06T08:07:24+0000 [twisted.internet.defer#critical] Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "/usr/local/lib/python2.7/site-packages/ussd_worker/mtn_ghana_ussd.py", line 60, in setup_transport super(MtnUSSDTransport, self).setup_transport() File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator return _cancellableInlineCallbacks(gen) File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks _inlineCallbacks(None, g, status) --- --- File "/usr/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "/usr/local/lib/python2.7/site-packages/vumi/transports/httprpc/httprpc.py", line 206, in setup_transport self.web_port) File "/usr/local/lib/python2.7/site-packages/vumi/service.py", line 239, in start_web_resources site_factory = build_web_site(resources, site_class=site_class) File "/usr/local/lib/python2.7/site-packages/vumi/utils.py", line 304, in build_web_site resources = sorted(resources, key=lambda r: len(r[0])) File "/usr/local/lib/python2.7/site-packages/vumi/utils.py", line 304, in resources = sorted(resources, key=lambda r: len(r[0])) exceptions.TypeError: object of type 'NoneType' has no len()

rudigiesler commented 4 years ago

Hi

Looking at this traceback, this seems to be an issue in your ussd_worker/mtn_ghana_ussd.py file, not in vumi itself. Without the contents of that file, unfortunately I can't tell what is causing this issue.

It seems to be that you're overriding the setup_transport function, so that might be a good place to start looking for the cause of the issue.

There are a number of transports in vumi, that you can take a look at and see how they're created, eg: https://github.com/praekeltfoundation/vumi/blob/develop/vumi/transports/mtech_ussd/mtech_ussd.py#L34-L41

seidu626 commented 4 years ago

Hello Rudi, Thanks for the reply, kindly find below repo for assistance. https://github.com/seidu626/vumi_apps I was modifying the Airtel Transport for the Comviva Flares HTTP Pull API for MTN Ghana

seidu626 commented 4 years ago

Hello I finally got it to work. I included the web_port and web_path in the config file. This is out of context though, but any guide to integrate vumi with rapidpro as a uusd channel will be much appreciated, thanks.

rudigiesler commented 4 years ago

Perfect.

For USSD with RapidPro, RapidPro doesn't have any USSD support, so it's not possible. Only SMS or other channels similar to SMS are possible.

For our production setups, we use the vumi javascript sandbox for the USSD applications, and integrate with RapidPro using RapidPro's API https://vumi-jssandbox-toolkit.readthedocs.io/ https://textit.in/api/v2/