TanmoySG / wunder-identity-provider

ID Provider for Wunder Platform. Authentication & Authorization Server for all wunder products
3 stars 0 forks source link

[Bug Fix] Socket Issue in Mailer #86

Open TanmoySG opened 2 years ago

TanmoySG commented 2 years ago

Describe the bug While running wIP - both using the flask app and docker container - on my MacBook I faced a Socket Error in Mailer while wIP tried sending a mail.

To Reproduce Steps to reproduce the behavior:

  1. Clone the Repo
  2. Run It locally - not on Codespaces
  3. Try running /register/generate/ , see docs
  4. See error

Expected behavior The Flask app should successfully send the mail and return a success message.

Screenshots

image

Snippet

[2022-04-11 16:34:15,082] ERROR in app: Exception on /register/generate [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_functio
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "app.py", line 22, in new_registration_request
    response = REQUEST_PROCESSOR().new_registration_request_processor(
  File "/app/providers/request_processor.py", line 38, in new_registration_request_processor
    response = REGISTRATION_MAILER.send_mail(request_data["email"])
  File "/app/providers/mailer/mailer.py", line 56, in send_mail
    with smtplib.SMTP_SSL(serverAddress, port, context=context) as server:
  File "/usr/local/lib/python3.8/smtplib.py", line 1048, in __init__
    SMTP.__init__(self, host, port, local_hostname, timeout,
  File "/usr/local/lib/python3.8/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python3.8/smtplib.py", line 339, in connect
    self.sock = self._get_socket(host, port, self.timeout
  File "/usr/local/lib/python3.8/smtplib.py", line 1054, in _get_socket
    new_socket = socket.create_connection((host, port), timeout
  File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
    raise err
  File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
    sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

Desktop (please complete the following information):