jookies / jasmin

Jasmin - Open source SMS gateway
http://jasminsms.com
Other
1.04k stars 556 forks source link

Rest API sendbatch on Docker not working #997

Closed r0unflame closed 3 years ago

r0unflame commented 3 years ago

I am running jasmin on docker and have enabled the REST API using the command: twistd -n --pidfile=/tmp/twistd-web-restapi.pid web --wsgi=jasmin.protocols.rest.api

All endpoints are working except for POST /secure/sendbatch. I am getting the error below when i try to use it. 2021-07-28T10:26:04+0000 [twisted.web.wsgi._WSGIResponse#critical] WSGI application error Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/twisted/python/threadpool.py", line 266, in <lambda> inContext.theWork = lambda: context.call(ctx, func, *args, **kw) File "/usr/local/lib/python3.9/site-packages/twisted/python/context.py", line 122, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/local/lib/python3.9/site-packages/twisted/python/context.py", line 85, in callWithContext return func(*args,**kw) File "/usr/local/lib/python3.9/site-packages/twisted/web/wsgi.py", line 533, in run self.started = True --- <exception caught here> --- File "/usr/local/lib/python3.9/site-packages/twisted/web/wsgi.py", line 505, in run appIterator = self.application(self.environ, self.startResponse) File "/usr/local/lib/python3.9/site-packages/falcon/api.py", line 269, in __call__ responder(req, resp, **params) File "/usr/local/lib/python3.9/site-packages/jasmin/protocols/rest/api.py", line 237, in on_post httpapi_send.delay(batch_id, params.get('batch_config', {}), message_params, config) File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 421, in delay return self.apply_async(args, kwargs) File "/usr/local/lib/python3.9/site-packages/celery/app/task.py", line 561, in apply_async return app.send_task( File "/usr/local/lib/python3.9/site-packages/celery/app/base.py", line 748, in send_task self.backend.on_task_call(P, task_id) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 343, in on_task_call self.result_consumer.consume_from(task_id) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 159, in consume_from return self.start(task_id) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 137, in start self._consume_from(initial_task_id) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 167, in _consume_from self._pubsub.subscribe(key) File "/usr/local/lib/python3.9/contextlib.py", line 135, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 120, in reconnect_on_error self._ensure(self._reconnect_pubsub, ()) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 354, in ensure return retry_over_time( File "/usr/local/lib/python3.9/site-packages/kombu/utils/functional.py", line 325, in retry_over_time return fun(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/celery/backends/redis.py", line 105, in _reconnect_pubsub metas = self.backend.client.mget(self.subscribed_to) File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1644, in mget return self.execute_command('MGET', *args, **options) File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 875, in execute_command conn = self.connection or pool.get_connection(command_name, **options) File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 1185, in get_connection connection.connect() File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 557, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:6379. Connection refused.

I will appreciate any help in solving this issue.

retromack commented 2 years ago

@r0unflame How did you solve this? I'm facing the same issue.

sarifishak commented 1 year ago

It solved. Refer this:

https://github.com/jookies/jasmin/issues/704