1

I have a script on a server that looks like this.

request = require('request');
require('longjohn');
request.post(
    { 
        url : 'https://example.com/api/thing/',
        form : {
            api_key : "blahblah",
            thing_id : 0
        },
        json : true
    },
    function(error, response, body){
        console.log(error, response);
    }
);

When i run it locally, It works perfectly, but when I run it on the server i get this.

{ [Error: read ECONNRESET]
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read',
__cached_trace__: 
[ { receiver: [Object],
   fun: [Function: errnoException],
   pos: 22969 },
 { receiver: [Object], fun: [Function: onread], pos: 14584 },
 {},
 { receiver: [Object], fun: [Function], pos: 19529 },
 { receiver: [Object], fun: [Function], pos: 49346 },
 { receiver: [Object],
   fun: [Function: _tickCallback],
   pos: 14030 },
 { receiver: [Object], fun: [Function], pos: 14031 },
 { receiver: [Object], fun: [Object], pos: 4502 },
 { receiver: [Object], fun: [Function], pos: 28039 },
 {},
 { receiver: [Object], fun: [Function], pos: 48679 },
 { receiver: [Object], fun: [Function], pos: 36057 },
 { receiver: [Object], fun: [Object], pos: 40546 },
 { receiver: [Object], fun: [Function], pos: 3570 },
 { receiver: [Object], fun: [Function], pos: 17260 },
 { receiver: [Object], fun: [Function], pos: 36440 },
 { receiver: [Object], fun: [Function], pos: 11960 },
 {},
 { receiver: [Object], fun: [Function], pos: 11634 },
 { receiver: [Object], fun: [Object], pos: 2292 },
 { receiver: [Object], fun: [Object], pos: 1738 },
 { receiver: [Object], fun: [Function], pos: 3238 },
 { receiver: {}, fun: [Function], pos: 121 },
 { receiver: [Object], fun: [Function], pos: 12854 },
 { receiver: [Object], fun: [Function], pos: 13365 },
 { receiver: [Object], fun: [Function], pos: 10114 } ],
 __previous__: 
 { [Error]
 id: 73,
 location: 'Readable.on (_stream_readable.js:679)',
 __location__: 'EventEmitter.on',
 __previous__: 
  { [Error]
    id: 60,
    location: 'ClientRequest.onSocket (http.js:1700)',
    __location__: 'process.nextTick',
    __previous__: [Object],
    __trace_count__: 2,
    __cached_trace__: [Object] },
 __trace_count__: 3,
 __cached_trace__: 
  [ [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    {},
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    {},
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object],
    [Object] ] } }

I am not familiar with the specifics of tcp sockets. If anyone has any thoughts or if you need more information, let me know.

Francis Yaconiello
  • 10,829
  • 2
  • 35
  • 54
quinton
  • 11
  • 3

1 Answers1

0

This ended up getting solved by our rackspace managed support team - it was a hardware configuration issue.

It looks like your problem is some where between the firewall and the load balancer.

It appears this issue is being caused by the DNS doctoring from the firewall.

If I set in the /etc/hosts file on xxx-node-prod-1 that the ip address for production.xxx.com is xxx.xxx.xxx.xxx, everything works perfectly.

The problem appears when the curl command is hitting the private natted ip of the load balancer.

we use a hardware FW and LB for this setup and something on their side was screwy.

Francis Yaconiello
  • 10,829
  • 2
  • 35
  • 54