arm-moodys opened a new issue, #31025:
URL: https://github.com/apache/superset/issues/31025

   ### Bug description
   
   Hi
   
   We're running into an issues that happens more often that not,
   
   I have deployed Superset on multiple environments on K8s using the official 
HelmChart, it's running on AWS EKS behind a Network Load Balancer, for ingress 
we use the Ngnix Ingress controller Helm chart. 
   
   The Log in page loads correctly every time we access it, no problems there. 
   
   The issue is after we provide the credentials and click on the `SIGN IN` 
button, most times it hangs and return a `404 NOT FOUND` for the 
`https://<DOMAIN_NAME>/favicon.ico`
   
![image](https://github.com/user-attachments/assets/9ba4bbe9-4876-4fd9-a64f-12d8c661c266)
   
   on the superset pod logs I can see the following every time it fails:
   
   ```bash
   HTTPException
   Traceback (most recent call last):
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1788, in 
dispatch_request
       self.raise_routing_exception(req)
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1770, in 
raise_routing_exception
       raise request.routing_exception  # type: ignore
     File "/usr/local/lib/python3.10/site-packages/flask/ctx.py", line 351, in 
match_request
       result = self.url_adapter.match(return_rule=True)  # type: ignore
     File "/usr/local/lib/python3.10/site-packages/werkzeug/routing/map.py", 
line 624, in match
       raise NotFound() from None
   werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found 
on the server. If you entered the URL manually please check your spelling and 
try again.
   2024-10-03 23:06:28,240:WARNING:superset.views.base:HTTPException
   Traceback (most recent call last):
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1788, in 
dispatch_request
       self.raise_routing_exception(req)
     File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1770, in 
raise_routing_exception
       raise request.routing_exception  # type: ignore
     File "/usr/local/lib/python3.10/site-packages/flask/ctx.py", line 351, in 
match_request
       result = self.url_adapter.match(return_rule=True)  # type: ignore
     File "/usr/local/lib/python3.10/site-packages/werkzeug/routing/map.py", 
line 624, in match
       raise NotFound() from None
   werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found 
on the server. If you entered the URL manually please check your spelling and 
try again.
   10.173.88.147 - - [03/Oct/2024:23:06:28 +0000] "GET /favicon.ico HTTP/1.1" 
404 0 "http://DOMAIN_OBFUSCATED/login/?next=/"; "Mozilla/5.0 (Windows NT 10.0; 
Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 
Safari/537.36
   ```
   
   As far as I understand all modern browser send a request to 
https://<DOMAIN_NAME>/favicon.ico`, the problem is that the Superset 
`favicon.ico` is actually under `/static/assets/images/favicon.png` so if you 
go to `https://<DOMAIN_NAME>//static/assets/images/favicon.png` you will see 
it, I know that the icon can be modified by adding the following to the 
superset_config.py and actually having the file in the specified path inside 
the container:
   
   ```python
   FAVICONS = [
         {"href": "/static/assets/images/favicon.png"},
         {
           "href": "/favicon.ico",  ## This is not accessible although the file 
exists this is I belive because flask doesn't expose anything but the what is 
under `/static` which in the container is under `/app/superset/static`
           "rel": "icon",
           "type": "image/x-icon",
         },
         {
           "href": "/static/favicon.ico", ## This accessible through: 
`https://<DOMAIN_NAME>//static/favicon.png`
           "rel": "icon",
           "type": "image/x-icon",
         }
       ]
   ```
   
   I have already tried all the suggested "workarounds" mentioned on:
   
   - 
https://superset.apache.org/docs/configuration/configuring-superset/#configuration-behind-a-load-balancer
   - https://github.com/apache/superset/issues/20319
   - 
https://stackoverflow.com/questions/48863061/favicon-ico-results-in-404-error-in-flask-app
 
   - https://flask.palletsprojects.com/en/stable/patterns/favicon/ 
   
   
   The last 2 links above mention a way to a flask route to expose the 
`favicon.ico` but so far I always ended up with a  `RuntimeError: Working 
outside of application context.` error.
   
   
   ## Semi "Workaround"
   
   Before continuing I want to clarify that the issue happens even without the 
AWS NLB, we tested this by simply forwarding the port locally and the same 
errors happens:
   
   ```bash
   kubectl port-forward service/superset 8088:8088
   ```
   
   My "workaround" so far is the following:
   
   In the superset_config.py I increase the `SUPERSET_WEBSERVER_TIMEOUT ` env 
variable value
   
   ```pyhon
   SUPERSET_WEBSERVER_TIMEOUT = 180
   ```
   
   In my K8s ingress I add the following annotations:
   
   ```yaml
   annotations: # 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md#custom-timeouts
       nginx.ingress.kubernetes.io/proxy-read-timeout: "200"
       nginx.ingress.kubernetes.io/proxy-connect-timeout: "200"
       nginx.ingress.kubernetes.io/proxy-send-timeout: "200"
   ```
   
   With that the hang issue persists but after approximately 2:30 mins the log 
in is successful or rejected if the users provides the wrong credentials but it 
takes a very long time to come back with the proper return.
   
   Besides all the suggestions mentioned above and in the links shared, do you 
have any other suggestions of what I can try?
   
   
   
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to