0

I am trying to replay a webhook request to 2 other instances of my API. The code is shown below. The endpoint to receive the replayed notification works, but the request is being received on the same instance instead of the other two. I'm not even sure how that is possible looking at the code. I thought that host is supposed to specify the url to request, but I may be misunderstanding it. I was modeling off of this question: How is an HTTP POST request made in node.js? Is there anything obvious that I am doing wrong? Thanks!

  var betaReq = https.request({
    host: 'some-product-beta.cloudfunctions.net',
    path: '/intercomEventsReplayed',
    method: 'POST',
    headers: req.headers
  });
  var prodReq = https.request({
    host: 'some-product-production.cloudfunctions.net',
    path: '/intercomEventsReplayed',
    method: 'POST',
    headers: req.headers
  });

  betaReq.write(JSON.stringify(req.body));
  betaReq.end();
  prodReq.write(JSON.stringify(req.body));
  prodReq.end();
deepak thomas
  • 1,118
  • 9
  • 23
Riley Fitzpatrick
  • 869
  • 2
  • 16
  • 38

0 Answers0