node-zendesk: ECONNRESET error on lib but curl works

We are using node-zendesk version 1.1.8 also tried the latest version but got the same error.

Request:

var zendesk = require('node-zendesk');
 
var client = zendesk.createClient({
  username:  'user',
  token:     'token',
  remoteUri: 'https://remote.zendesk.com/api/v2',
  debug: true
});
 
client.users.list(function (err, req, result) {
  if (err) {
    console.log(err);
    return;
  }
  console.log(JSON.stringify(result[0], null, 2, true));//gets the first page
});

Response

{ Error: read ECONNRESET
    at _errnoException (util.js:1003:13)
    at TLSWrap.onread (net.js:620:25) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }

but curl with

curl -i https://namshisupport.zendesk.com/api/v2/users.json -u user/token:longToken

It works and gives back json result.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Try v1.3.0

Thanks for all you guys help. Now 1.3.0 works for me. I think that was because I forgot to remove the node_modules folder, and the program still used the same package even if I changed to 1.3.0. After removing the node_modules and changed to 1.3.0, everything works. Thanks again for saving my day