HTTP 500 error in backend API in remove_secrets
Opened this issue · 1 comments
benoit74 commented
2024-09-02 23:20:59.340 ERROR:uwsgi_file__app_main:Exception on /v1/tasks/10bbe7fd-8b79-45be-b2f6-e5de9032781d [GET]
2024-09-02 23:20:59.340 Traceback (most recent call last):
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2190, in wsgi_app
2024-09-02 23:20:59.340 response = self.full_dispatch_request()
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1486, in full_dispatch_request
2024-09-02 23:20:59.340 rv = self.handle_user_exception(e)
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/site-packages/flask_cors/extension.py", line 165, in wrapped_function
2024-09-02 23:20:59.340 return cors_after_request(app.make_response(f(*args, **kwargs)))
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1484, in full_dispatch_request
2024-09-02 23:20:59.340 rv = self.dispatch_request()
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1469, in dispatch_request
2024-09-02 23:20:59.340 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2024-09-02 23:20:59.340 File "/app/./routes/base.py", line 20, in __call__
2024-09-02 23:20:59.340 return handler(*args, **kwargs)
2024-09-02 23:20:59.340 File "/app/./routes/__init__.py", line 70, in wrapper
2024-09-02 23:20:59.340 return f(*args, **kwargs)
2024-09-02 23:20:59.340 File "/app/./routes/__init__.py", line 87, in wrapper
2024-09-02 23:20:59.340 return f(*args, **kwargs)
2024-09-02 23:20:59.340 File "/app/./db/__init__.py", line 50, in inner
2024-09-02 23:20:59.340 return func(*args, **kwargs)
2024-09-02 23:20:59.340 File "/app/./routes/tasks/task.py", line 139, in get
2024-09-02 23:20:59.340 remove_secrets_from_response(task)
2024-09-02 23:20:59.340 File "/app/./routes/utils.py", line 29, in remove_secrets_from_response
2024-09-02 23:20:59.340 remove_url_secrets(response)
2024-09-02 23:20:59.340 File "/app/./routes/utils.py", line 101, in remove_url_secrets
2024-09-02 23:20:59.340 remove_url_secrets(response[key])
2024-09-02 23:20:59.340 File "/app/./routes/utils.py", line 106, in remove_url_secrets
2024-09-02 23:20:59.340 urlparts = urlsplit(url)
2024-09-02 23:20:59.340 File "/usr/local/lib/python3.8/urllib/parse.py", line 474, in urlsplit
2024-09-02 23:20:59.340 raise ValueError("Invalid IPv6 URL")
2024-09-02 23:20:59.340 ValueError: Invalid IPv6 URL
2024-09-02 23:20:59.340 [pid: 25|app: 0|req: 66316/264715] 100.64.6.75 () {54 vars in 1493 bytes} [Mon Sep 2 21:20:59 2024] GET /v1/tasks/10bbe7fd-8b79-45be-b2f6-e5de9032781d => generated 265 bytes in 45 msecs (HTTP/1.1 500) 3 headers in 131 bytes (1 switches on core 0)
Error was present for few minutes then gone. Request is now OK. I strongly suspect this is linked to bad "URL" (or something interpreted like this) in the logs. Logging the whole content would obviously help to diagnose this kind of issue ^^
benoit74 commented
We have the issue with a completed task: https://api.farm.zimit.kiwix.org/v1/tasks/836f2cea-6c28-40f6-8d78-76183458d1ec ; I have no idea what is causing the problem, we should probably just silently ignore when we fail to parse the URL.