Mass subscribe gives HTTP Error 500 when using custom template
Hi,
I have some issues with the Mass Subscribe option on Mailman 3.2.1. When using a custom "The notice sent to a member when they are subscribed to the mailing list." template, Postorius will throw an exception after pushing the "Subscribe Users" button on Mass Subscribe.
In the web interface you will see a red notification bar with the text: "HTTP Error 500: b'A server error occurred. Please contact the administrator.'". And in the Mailman.log you will see the following error message:
Traceback (most recent call last): File "/usr/lib/python3.7/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/lib/python3/dist-packages/mailman/database/transaction.py", line 50, in wrapper rtn = function(*args, **kws) File "/usr/lib/python3/dist-packages/mailman/rest/wsgiapp.py", line 216, in __call__ return super().__call__(environ, start_response) File "falcon/api.py", line 215, in falcon.api.API.__call__ File "falcon/api.py", line 189, in falcon.api.API.__call__ File "/usr/lib/python3/dist-packages/mailman/rest/members.py", line 266, in on_post pre_approved=pre_approved) File "/usr/lib/python3/dist-packages/mailman/app/subscriptions.py", line 520, in register list(workflow) File "/usr/lib/python3/dist-packages/mailman/app/workflow.py", line 69, in __next__ return step() File "/usr/lib/python3/dist-packages/mailman/app/subscriptions.py", line 326, in _step_do_subscription self.member = self.mlist.subscribe(self.subscriber) File "/usr/lib/python3/dist-packages/mailman/database/transaction.py", line 85, in wrapper return function(args[0], config.db.store, *args[1:], **kws) File "/usr/lib/python3/dist-packages/mailman/model/mailinglist.py", line 494, in subscribe notify(SubscriptionEvent(self, member)) File "/usr/lib/python3/dist-packages/zope/event/__init__.py", line 31, in notify subscriber(event) File "/usr/lib/python3/dist-packages/mailman/app/membership.py", line 169, in handle_SubscriptionEvent send_welcome_message(mlist, member, member.preferred_language) File "/usr/lib/python3/dist-packages/mailman/app/notifications.py", line 52, in send_welcome_message 'list:user:notice:welcome', mlist, language=language.code)) File "/usr/lib/python3/dist-packages/mailman/model/template.py", line 188, in get name, lookup_context, **substitutions) File "/usr/lib/python3/dist-packages/mailman/database/transaction.py", line 85, in wrapper return function(args[0], config.db.store, *args[1:], **kws) File "/usr/lib/python3/dist-packages/mailman/model/template.py", line 109, in get contents = protocols.get(actual_uri, **auth) File "/usr/lib/python3/dist-packages/mailman/utilities/protocols.py", line 38, in get response = requests.get(url, timeout=REQUEST_TIMEOUT, **kws) 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=8000): Max retries exceeded with url: /postorius/api/templates/list/<MAILINGLIST>/list:user:notice:welcome (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0b5ce8d8d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Postorius/Mailman is running on port 8001, only Postorius still connecting on port 8000.
Anyone seen something similar?
Thanks in advance! Jeffrey
On 1/28/20 6:15 AM, Jeffrey D wrote:
Hi,
I have some issues with the Mass Subscribe option on Mailman 3.2.1. When using a custom "The notice sent to a member when they are subscribed to the mailing list." template, Postorius will throw an exception after pushing the "Subscribe Users" button on Mass Subscribe. ... requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /postorius/api/templates/list/<MAILINGLIST>/list:user:notice:welcome (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0b5ce8d8d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Postorius/Mailman is running on port 8001, only Postorius still connecting on port 8000.
What is your setting in settings(_local).py for POSTORIUS_TEMPLATE_BASE_URL? It looks like you have the default
POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000'
It should be the base URL for connecting to Postorius. I.e., if you normally connect to Postorius via https://www.example.com/postorius, it should be https://www.example.com
You say Postorius/Mailman is running on port 8001. Mailman core's rest server should be listening on port 8001, but your web server can't proxy to Postorius on that port. Normally, the wsgi server that supports wsgi access to Django (Postorius and HyperKitty) listens on port 8000, at least if it is gunicorn or uwsgi proxied from your web server, or if it's Apache and mod_wsgi, proxying is not involved.
Again, it looks like you may be using Apache and mod_wsgi in which case you could have POSTORIUS_TEMPLATE_BASE_URL set to something like https://www.example.com or even http://localhost or http://localhost:80, but not port 8000 if no wsgi server is listening there.
Also, the URL is now in the database entry for this template in the postorius_emailtemplate table, so even after you fix POSTORIUS_TEMPLATE_BASE_URL, you'll probably have to delete and recreate the template in Postorius.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mark Sapiro wrote:
On 1/28/20 6:15 AM, Jeffrey D wrote:
What is your setting in settings(_local).py for POSTORIUS_TEMPLATE_BASE_URL? It looks like you have the default POSTORIUS_TEMPLATE_BASE_URL = 'http://localhost:8000' It should be the base URL for connecting to Postorius. I.e., if you normally connect to Postorius via https://www.example.com/postorius, it should be https://www.example.com
Thanks, changing the POSTORIUS_TEMPLATE_BASE_URL fixing the issue.
participants (2)
-
Jeffrey D
-
Mark Sapiro