If the host is not reachable/time's out through volto-corsproxy, the nodejs/razzele/webpack-dev-server crashes
Opened this issue · 4 comments
This might be related to #2 where missing error handling is also mentionned. When in dev mode the content cannot be fetched, the whole frontend/ssr servers crashes. I need to restart the volto server to be able to retrieve any frontend pages. For example:
proxy error connect ETIMEDOUT 10.31.14.100:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1607:16) {
errno: -60,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '10.31.14.100',
port: 443
}
Error: connect ETIMEDOUT 10.31.14.100:443
at ProxyServer.onError (/Users/fred/projects/my-project/frontend/frontend/node_modules/@eeacms/volto-corsproxy/src/index.js:48:1)
at ProxyServer.emit (/Users/fred/projects/my-project/frontend/node_modules/eventemitter3/index.js:210:27)
at RedirectableRequest.proxyError (/Users/fred/projects/my-project/frontend/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:165:18)
at RedirectableRequest.emit (node:events:531:35)
at ClientRequest.eventHandlers.<computed> (/Users/fred/projects/my-project/frontend/node_modules/follow-redirects/index.js:38:24)
at ClientRequest.emit (node:events:519:28)
at emitErrorEvent (node:_http_client:108:11)
at TLSSocket.socketErrorListener (node:_http_client:511:5)
at TLSSocket.emit (node:events:519:28)
@avoinea @tiberiuichim Is this something you recognise as an issue with the current implementation of the proxy?
Sure, it is is a list of the allowed api URL's:
allowed_cors_destinations: [
'api.vmm.vlaanderen.be',
],
The error doesn't happen consistently, only when the API itself is flakey. And we know it sometimes times out. The problem is that is then somehow crashes/locks up the volto node process. Hopefully, if the cors destination isn't allowed according tot he list, an incoming request to /volto-corsproxy would also keep the node process running.
@fredvd I'm not sure how that would crash the express server. I can see that the foreign API errors is caught, as the error is logged and then thrown again. https://github.com/eea/volto-corsproxy/blob/75aed18ad62c3174acfbd2da88abf1f42932fc7c/src/index.js#L48C9-L48C30
Maybe something more needs to be done around that area of code.