PnX-SI / UsersHub-authentification-module

Module Flask d'authentification de UsersHub
GNU General Public License v3.0
5 stars 12 forks source link

Erreur sur inscription ou récup de mdp #29

Closed jbrieuclp closed 4 years ago

jbrieuclp commented 4 years ago

J'ai une erreur qui me semble être plus lié soit au param du serveur (apache ?) ou d'une lib python, mais j'en sais trop rien en fait... Est-ce que quelqu'un a déjà vu ce type de log ? Ce log dans le bouzin me fait tiquer Failed to establish a new connection: [Errno -2] Name or service not known',)))

Exception on /users/inscription [POST]
Traceback (most recent call last):
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connection.py", line 159, in _new_conn
      (self._dns_host, self.port), self.timeout, **extra_kw)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/util/connection.py", line 57, in create_connection
      for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
   File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
      for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 600, in urlopen
      chunked=chunked)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 354, in _make_request
      conn.request(method, url, **httplib_request_kw)
   File "/usr/lib/python3.5/http/client.py", line 1107, in request
      self._send_request(method, url, body, headers)
   File "/usr/lib/python3.5/http/client.py", line 1152, in _send_request
      self.endheaders(body)
   File "/usr/lib/python3.5/http/client.py", line 1103, in endheaders
      self._send_output(message_body)
   File "/usr/lib/python3.5/http/client.py", line 934, in _send_output
      self.send(msg)
   File "/usr/lib/python3.5/http/client.py", line 877, in send
      self.connect()
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connection.py", line 181, in connect
      conn = self._new_conn()
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connection.py", line 168, in _new_conn
      self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fb0627a49b0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/requests/adapters.py", line 449, in send
      timeout=timeout
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 638, in urlopen
      _stacktrace=sys.exc_info()[2])
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/urllib3/util/retry.py", line 399, in increment
      raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host="''", port=80): Max retries exceeded with url: http://outils.gretia.org/geonature/api/pypn/register/post_usershub/create_temp_user  (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb0627a49b0>: Failed to establish a new connection: [Errno -2] Name or service not known',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/app.py", line 2446, in wsgi_app
      response = self.full_dispatch_request()
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1951, in full_dispatch_request
      rv = self.handle_user_exception(e)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask_cors/extension.py", line 161, in wrapped_function
      return cors_after_request(app.make_response(f(*args, **kwargs)))
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1820, in handle_user_exception
      reraise(exc_type, exc_value, tb)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/_compat.py", line 39, in reraise
      raise value
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1949, in full_dispatch_request
      rv = self.dispatch_request()
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/flask/app.py", line 1935, in dispatch_request
      return self.view_functions[rule.endpoint](**req.view_args)
   File "/home/www/geonature/backend/geonature/core/users/routes.py", line 286, in inscription
      json=data,
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/requests/sessions.py", line 581, in post
      return self.request('POST', url, data=data, json=json, **kwargs)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/requests/sessions.py", line 533, in request
      resp = self.send(prep, **send_kwargs)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/requests/sessions.py", line 646, in send
      r = adapter.send(request, **kwargs)
   File "/home/www/geonature/backend/venv/lib/python3.5/site-packages/requests/adapters.py", line 510, in send
      raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPConnectionPool(host="''", port=80): Max retries exceeded with url: http://outils.gretia.org/geonature/api/pypn/register/post_usershub/create_temp_user  (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb0627a49b0>: Failed to establish a new connection: [Errno -2] Name or service not known',)))
jbrieuclp commented 4 years ago

Je rajoute comme info que je suis sur la branche develop de Geonature, Usershub 2.1.0 et UsersHub-authentification-module 1.4.3.

Je n'ai pas d'erreur quand j'ai flask en mode dev geonature dev_back ca plante quand supervisor est lancé. Une idée ? 🆘

amandine-sahl commented 4 years ago

Le problème vient du commit #8fb48

export HTTP_PROXY="'$proxy_http'"
export HTTPS_PROXY="'$proxy_https'"

Je n'ai pas eu le temps de plus investiguer que ça mais en commentant ces lignes ça fonctionne pour le moment.

jbrieuclp commented 4 years ago

Tu observes le même problème ? Tu as un lien pour le commit parce que là c'est vache pour le retrouver :-/

Edit : pour le lien : https://github.com/PnX-SI/GeoNature/commit/8fb48

camillemonchicourt commented 4 years ago

Oui il s'agit de ce commit : https://github.com/PnX-SI/GeoNature/commit/8fb48

Lié à ce commit où @TheoLechemia a ajouté ce paramètre dans le cas où GeoNature est installé derrière un proxy : https://github.com/PnX-SI/GeoNature/commit/490431820a19965df4b70d3f0e83c4cad7ecc57f

On n'a pas rencontré de problème de notre côté.

amandine-sahl commented 4 years ago

Vous avez tester la regénération des mots de passe?

jbrieuclp commented 4 years ago

Ok du coup j'ai viré mes 2 derniers post (sur mes différentes recherches j'avais commenté ça https://github.com/PnX-SI/UsersHub/blob/b7cea35b45f84e17772c1ebfd1b46fb8f5e71f19/app/api/route_register.py#L39) Donc en commentant les 2 lignes de proxy la récuperation de mdp fonctionne tout comme la création de compte ! Cimer @amandine-sahl pour ce "patch"

amandine-sahl commented 4 years ago

Pour le moment je propose de réaliser un test sur la présence ou non des variables proxy et de ne les activer que si nécessaire.

camillemonchicourt commented 4 years ago

OK

TheoLechemia commented 4 years ago

Ok merci, de ce que j'avais testé le fait de mettre ces variables vides ne posait pas de problème. J'étais pas tombé sur ce cas là. Merci

camillemonchicourt commented 4 years ago

Réglé dans GeoNature 2.3.1 à venir