kevinohara80 / nforce

nforce is a node.js salesforce REST API wrapper for force.com, database.com, and salesforce.com
MIT License
474 stars 167 forks source link

Error durring token refresh #54

Closed RichardOzols closed 10 years ago

RichardOzols commented 10 years ago

I just updated one of my apps to version 0.7.0 and noticed some strange error.

When I call the token refresh method, it works fine when I send it oauth data from the session, but returns an error when I send oauth data from my mongoDB.

This is working

SFDC.insert({ sobject: object, oauth: req.session.user.salesforce }, function(error, response){
  //log the results
});

This is returning and error

User.findById(user_id, function(err, user) {
  SFDC.insert({ sobject: object, oauth: user.salesforce }, function(error, response){
    //log the results
  });
});

[Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read']

I have debugged both session and db user oauth details and they are the same. This only happens when the refresh token method is called everything else works fine like insert, quert etc... and refresh token works fine with versions 0.6.x., 0.7.0 is where this starts.

Hope you can help me figuring this one out.

Cheers

kevinohara80 commented 10 years ago

I have no idea. It's going to take me a while to try to reproduce this. Do you have any more details?

Are you using the auto-refresh in the latest version or calling refreshToken() yourself?

Also, the error message you posted is from the callback from SFDC.insert(), right?

kevinohara80 commented 10 years ago

If you are still having issues and you can answers my questions, feel free to re-open.