Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
Socket Error while REST Call in via method POST not working

We have below curl commands which run perfect.

curl -x http://x.x.x.x:9999 -X POST -F token=aaa -F "ref=prod_call" -F variables[name]="No" -F variables[CR_Number]="" -F variables[HOSTS_FILE]="lil.ini" https://gitlab.com/api/v4/projects/1111/trigger/pipeline

Now same thing I implemented in node js and unfortunately it is not working

function callPipeline(){
    console.log("The host we are going to execute here")
    console.log("The command  are going to execute here")

    var formdata = new FormData();
    formdata.append("token", "aaa");
    formdata.append("ref", "prod_call");
    formdata.append("variables[name]", "No");
    formdata.append("variables[CR_Number]", "");
    formdata.append("variables[HOSTS_FILE]", "lil.ini");
    

 var options = {
  method: 'POST',
  host: "x.x.x.x", //proxy server
  port: 9999,
  path: "https://gitlab.com/api/v4/projects/1111/trigger/pipeline",
  body: formdata,
};

return new Promise((resolve, reject) => {

  http.request(options, function(res, err) {
    console.log(res);

    console.log(err);
    //res.pipe(process.stdout);
    resolve(res.toString() + "---err---" +err.toString())
    
  });
  

})


  

}

Getting error

node:events:498
      throw er; // Unhandled 'error' event
      ^

Error: socket hang up
    at connResetException (node:internal/errors:691:14)
    at Socket.socketOnEnd (node:_http_client:466:23)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ClientRequest instance at:
    at Socket.socketOnEnd (node:_http_client:466:9)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET'
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda