Hi @Abduh_Salam,
The “socket hang up” and ECONNRESET
errors you’re seeing typically occur when there’s a network interruption or a proxy misconfiguration—especially behind a corporate proxy. Here’s a structured approach to troubleshoot and fix it:
Checklist to Resolve “socket hang up” Behind Corporate Proxy in n8n:
1. Confirm Proxy with Node.js
Since curl
works, but n8n doesn’t, it’s likely a Node.js-specific issue. Test with plain Node.js:
const https = require('https');
https.get('https://api.ipify.org?format=json', (res) => {
res.on('data', (d) => {
process.stdout.write(d);
});
}).on('error', (e) => {
console.error(e);
});
Run with your proxy settings:
set HTTP_PROXY=http://corporate.co.id:8080
set HTTPS_PROXY=http://corporate.co.id:8080
node test.js
If this fails, the problem is your Node proxy config.
2. Use global-agent
(If Not Already)
n8n
uses Node under the hood, and the global-agent library can help route all HTTP/HTTPS traffic through the proxy.
Install if you haven’t:
npm install global-agent
Create a proxy-loader.js
file with:
require('global-agent/bootstrap');
Then run n8n like this:
set GLOBAL_AGENT_HTTP_PROXY=http://corporate.co.id:8080
node -r ./proxy-loader.js node_modules/n8n/bin/n8n
3. Use Environment File Instead
Sometimes the set
command doesn’t persist well. Try putting your env vars in a .env
file:
HTTP_PROXY=http://corporate.co.id:8080
HTTPS_PROXY=http://corporate.co.id:8080
GLOBAL_AGENT_HTTP_PROXY=http://corporate.co.id:8080
NODE_TLS_REJECT_UNAUTHORIZED=0
Then use dotenv-cli to run:
npx dotenv -e .env -- n8n
4. Whitelist or Bypass Proxy for Localhost
Ensure your proxy settings don’t interfere with localhost:
set NO_PROXY=localhost,127.0.0.1
5. Windows-Specific: Use PowerShell Instead of CMD
Some proxy env vars behave differently depending on the shell. Try running the commands in PowerShell instead of CMD.
If this still doesn’t work, let me know:
- Are you using NTLM auth proxy?
- Do you require login credentials for the proxy?
Those cases may require something like node-ntlm-proxy-agent
.
I hope this helps.