I have a problem with socket.io not accepting connections.
I have setup my ERPNext manually in a VPS, Almost everything works well except for socket.io which gives 502 error in the browser network tab like this:
GET /socket.io/?EIO=3&transport=polling&t=NrPeAQm HTTP/3
Host: example.com
and the response is like:
HTTP/3 502 Bad Gateway
content-type: text/html; charset=UTF-8
server: cloudflare
Here’s an example of repetitive error message in /var/logs/nginx/error.log:
Trying restarting the VPS. I know every time I install ERPNext on a new server socketio is always giving me issues. After trying a new config then running sudo reboot It magically worked for me.
It may help to describe the manual setup that was used to install. Operating environment, versions of apps etc and steps taken to install. That may provide clues.
Thanks so much @revant_one , POST requests are working now but not GET unfortunately, It doesn’t even get initialized by the browser idk why!! Anyway, I’m happy about the current setup and I’ve already documented all of my manual setup instructions from the beginning, and I’m going to post them here in the forum.
Answer by @revant_one is the solution. However, additionally make sure that:
supervisor is reloaded with new config file – service supervisor restart bench restart
in my case even after the config file was showing the [program:frappe-bench-node-socketio]
but bench restart was never listing the frappe-bench-web:frappe-bench-node-socketio: (for any status, as revant_one was also wondering!), this pointed me to realize supervisorctl is not reading the updated config file.
@revant_one ideally isn’t bench restart be doing service supervisor restart internally? I know this could spoil the redis cache. But no point restarting bench with old config. Or alternatively there could be a switch say bench restart --refresh-supervisor-config.