Strange behavior of code in a node's function

Because I couln’t use axios (see my previous post about it), I use native modules to post data through a proxy (http+tls). This code of the function works well alone, but connection does not trigger in the node, could you see why ?

function sendAlert(ci: ConnectItems, alert: Alert) {
   var req = Http.request({
      host: ci.proxy,
      port: 3128,
      method: 'CONNECT',
      path: ci.url + ":443"
   });
   req.on('connect', function (res, socket, head) {
      var cts = Tls.connect({
         host: ci.url,
         socket: socket,
      }, function () {
         cts.write("POST /api/alert HTTP/1.0 .......
      });

n8n has already a request library “built-in”. So no need to use anything else.

It can be used like this:

const options = {
	method: 'POST',
	body: {},
	uri: `https://example.com`,
	json: true,
};
const responseData = await this.helpers.request(options);

Possible options can be found here:

An example usage can be found in almost every n8n node like here Mailgun:

Thanks jan, I didn’t dare because request is marked deprecated …
About the syntax, you also use the request module in core n8n for exemple here https://github.com/n8n-io/n8n/blob/master/packages/core/src/NodeExecuteFunctions.ts#L193 , but I can’t see where this.helpers points to, could you enlighten me ?
(github code navigation seems sometimes wrong to me)
(and i’ve just seen that https://docs.n8n.io/nodes/creating-nodes/create-node.html#use-the-built-in-request-library), why ‘helpers’ ?

Yes, it is deprecated. At the time it was written it was not. So at some point, we have to move over to something else. Is already on the To-Do list.

Exactly, it is using the request-module under the hood.
It points to here (line 720):

Honestly not sure if I understand the question but because I had to call it somehow and I choose the term “helpers”.