My biggest WTH moment is when I try to update my HA installation via the interface and when I receive an undescriptive error.
I can understand that this is due to the fact that NGINX has a certain timeout on a request, however in that case the error could be more descriptive. Now I just press the update button a few times and I hope it will do a reload, when I have the newest version. (or I just use the CLI).
Error: <html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx/1.16.1</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page -->
I’m look at the same message every morning (when I upgrade my production system to the latest development build). This error message is not thrown by Home Assistant, but by the reverse proxy itself (NGINX).
The Home Assistant gets a timeout served by the NGINX proxy it didn’t expect and simply passes as is.
I am not sure yet what the best way would be to handle this scenario. One of the reasons that I posted it here is to gather some more user input, since I believe everyone running the official proxy addon will face the same issue.
A quick fix could be to catch the 504 error in the front-end when the NGINX addon is active
and show a descriptive message like:
[Unable to gather update status due to a timeout. This is most likely due to the fact that you are running NGINX bla bla bla]. + a way to refresh the update status?
However, my preference would be to gather the update status feedback in a different way. Instead of doing a post and waiting for an answer from /api/hassio/homeassistant/update, it would be good to just send the update request and poll for an update / receive an update via a websocket.
But this is not a quick fix and I can understand that there are other priorities in the development of HA.
I also suggest API to be more async, i.e. give immediate reply to the request (after some checks if needed but before actual restart) and provide update status via some other means if the API remains running at all. If system goes down then only thing client can do is to try to reconnect until it succeeds.