Problem with POST call using HTTP Request node (read ECONNRESET - rejected)

Hello,

When I build my dockerimage with Dockerfile I use sed command to add this piece of code in NodeExecuteFunctions.js file.

First it check if I need to use proxy env (with a boolean) and if yes I use https-proxy-agent to set proxy var.

const no_proxy = process.env.no_proxy.split(',');
    var use_proxy = true;
    for (let i = 0; i < no_proxy.length; i++){
        if (requestObject.uri.includes(no_proxy[i]) ) {
            use_proxy = false;
        }
    }
    if (use_proxy) {    
        const { HttpsProxyAgent } = require("https-proxy-agent");
        const agent = new HttpsProxyAgent(process.env.http_proxy);
        axiosConfig.httpAgent = agent;
        axiosConfig.httpsAgent = agent;
        axiosConfig.proxy = false;
    }
2 Likes

This should be sorted very soon.

1 Like

Hello @Jon,

Can you tell me if it’s still possible with n8n to read env var from node ? I updated in v1.33.0 (but I also tested i v1.31.0) and I cannot read anymore env var from code node.

Do I know how can I fix this ? The following WF not work anymore (few months before it worked)

Hey @Kent1,

You can set N8N_BLOCK_ENV_ACCESS_IN_NODE to false although I thought that was the default so it should work.

Hi @Jon,

Thank for your reply.

Digging more into my initial issue my problem comes from the fact that I use a trick to be able to use http proxy for https requests.

But since this change bellow I have sometimes some issues :

  • core: Apply correct hostname to redirected requests (#8674) (0e36aeb)

Is there an official solution to be able to use http proxy for HTTPS requests ? Currently if I remove my update in NodeExecuteFunctions.js file I can’t make HTTPS requests at all.

Hey @Kent1,

No official solution yet however… We have recently hired 3 new support team members so once they are up to speed I will be able to get back to fixing issues like this.

I wonder why the unofficial change isn’t fully working, The change itself looked good to me so I guess there are other things to take into consideration with it.

Thank @Jon.

In fact there is a redirection where an overwrite of HttpsProxyAgent is made by Agent in the “getBeforeRedirectFn” function so my proxy is not used anymore.

image

I managed this but I don’t really like to “fork” n8n, it could cause bigger issue in the future (like the one where are currently speaking) and event if I currently able to bypass this I’m not sure I always could

1 Like