Open Sonsbecker opened 3 years ago
If I understand correctly, you run the proxy server directly with Node.js, not with Docker? Then you could modify the file lib/server.js to help pin down the error. At the end of the file, you find the following code:
/**
* Handle proxy errors
*/
proxy.on('error', (err, req, res) => {
sendResponse(null, req, res, 500, err.message || '' + err);
});
Change it to:
/**
* Handle proxy errors
*/
proxy.on('error', (err, req, res) => {
const errorMessage = err.message || '' + err;
log.e(`[${req.__requestId}] Proxy error: ${errorMessage}`);
sendResponse(null, req, res, 500, errorMessage);
});
Then restart the server, wait for the error to reappear and post the log output here. Thank you!
I made the change. However, I don't see any change in the output. Here is the full output after starting the script.
` added 17 packages, and audited 18 packages in 6s
2 high severity vulnerabilities
To address all issues (including breaking changes), run: npm audit fix --force
Run npm audit
for details.
proxy:info Proxy server listening: { address: '::', family: 'IPv6', port: 3000 } +0ms
proxy:error socket hang up +0ms
proxy:error [8820/9154] Sending error response: 500 socket hang up +2ms
proxy:error read ECONNRESET +31m
proxy:error [1859697/1246] Sending error response: 500 read ECONNRESET +111ms
proxy:error write ETIMEDOUT +3h
proxy:error [12533928/9443] Sending error response: 500 write ETIMEDOUT +4ms
_http_outgoing.js:526
throw new ERR_HTTP_HEADERS_SENT('set');
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:526:11)
at sendResponse (/usr/basic-to-passport-auth-http-proxy-master/lib/server.js:48:17)
at ProxyServer.
Or is there a log file somewhere where the errors are recorded?
I suggest to run the script with forever or to use the provided Docker image, which uses forever internally. The forever command in the Docker image is forever --minUptime 1000 --spinSleepTime 1000 lib/server.js
. This is a hacky workaround which restarts the script whenever it crashes, but might be a solution depending on the root cause for the ECONNRESET error.
Hello, I use the script (as "root") with Node.js (v12) to establish a HyperBackup connection to OneDrive on a Synology server (DS214 + DSM6.2.3-25426 Update 3). I proceeded exactly according to "README". It works.
But after a while the following error messages appear and the script is terminated completely. Can no longer connect to OneDrive. Only when I restart the script.
What's wrong? Or to put it better: What can I do to ensure that the connection is automatically re-established?
many greetings
Benjamin