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

Crash application when json parsing #85

Closed Laboratory closed 9 years ago

Laboratory commented 9 years ago

Application should not crash in this solution.

W20150410-02:31:02.069(3)? (STDERR) Error: Invalid JSON response from Salesforce
W20150410-02:31:02.069(3)? (STDERR)     at Object.module.exports.invalidJson (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/lib/errors.js:8:12)
W20150410-02:31:02.069(3)? (STDERR)     at processResponse (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/index.js:939:43)
W20150410-02:31:02.070(3)? (STDERR)     at Request._callback (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/index.js:1010:7)
W20150410-02:31:02.070(3)? (STDERR)     at Request.self.callback (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/node_modules/request/request.js:368:22)
W20150410-02:31:02.070(3)? (STDERR)     at Request.emit (events.js:98:17)
W20150410-02:31:02.070(3)? (STDERR)     at Request.<anonymous> (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/node_modules/request/request.js:1219:14)
W20150410-02:31:02.070(3)? (STDERR)     at Request.emit (events.js:117:20)
W20150410-02:31:02.070(3)? (STDERR)     at IncomingMessage.<anonymous> (/Users/Laboratory/tmp/db/meteor/av/meteor-app/.meteor/local/isopacks/_nforce-sync/npm/node_modules/nforce/node_modules/request/request.js:1167:12)
W20150410-02:31:02.070(3)? (STDERR)     at IncomingMessage.emit (events.js:117:20)
W20150410-02:31:02.070(3)? (STDERR)     at _stream_readable.js:943:16
W20150410-02:31:02.071(3)? (STDERR)     at process._tickCallback (node.js:419:13)
I20150410-02:31:05.366(3)? mongodb://localhost:3002/meteor connect
=> Meteor server restarted
kevinohara80 commented 9 years ago

Not sure I can help here without some additional context.

Also, that error is a returned (not thrown) error that arises when Salesforce returns an invalid json response which happens in some edge case scenarios. Not sure why a callback with an error would crash your app but it's hard to say without seeing any of the code.

kevinohara80 commented 9 years ago

If you are still having issues and can provide some context and code, feel free to re-open the issue