I’m trying to use a proxy server in HTTP Request (I put it in the options section of the node)
And this kind of error occurs, no matter what server address I specify:
NodeApiError: UNKNOWN ERROR - check the detailed error for more information
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest.node.js:860:27)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47
We’re currently on n8n v. 0.142.0, and it’s being run in Docker.
Hi @Uness, have you tried setting the N8N_USE_DEPRECATED_REQUEST_LIB=true enviroment variable suggested by Ricardo to (temporarily) switch to the old library to see if this addresses the issue?
I can see that my colleagues have already flagged this to @krynble who will be back next week and who will take a closer look into the implications of the library change in this context. Until then it would be of great help if you could the above suggestion a go to narrow down the issue.
I got bored so took a quick look at this one, The problem is the proxy option is being sent in the wrong format to Axios so you end up with "proxy": "whatever_the_value" and it looks like Axios wants an object like "proxy" : { "host": "host_name", "port": "port" }
As a very quick and dirty concept if you pop open HttpRequest.node.ts and find if (options.proxy !== undefined) ~ line 715…
Replace:
requestOptions.proxy = options.proxy as string;
With
let proxy = (options.proxy as string).split(":");
requestOptions.proxy = {host: proxy[0], port: proxy[1]};
It will start working as expected, There is a catch though… In the UI where you input the proxy address it won’t work with a protocol as Axios always assumes HTTPS (why would you use an HTTP proxy anyway) so you would need to input the IP / Hostname and port like 13.229.73.17:443 (this is a proxy I found on the free list)
Happy to pop in a pull request with this quick fix but I think a better one might be to have 2 fields for proxy one for host and one for port and if it can be worked out a select box for the protocol (HTTP / HTTPS / SOCKS(?) ).
Anyway… I hope this helps those with problems using proxies.
@krynble looks good to me, I didn’t look into the protocol side of Axios too much but if you specify HTTP does that include HTTPS as well or does HTTPS need to be a config option as I can’t see many people using an HTTP proxy.