jsforce ignoring callback functions?

125 Views Asked by At

I tool the code right out of the docs, but it's like it completely ignores the existence is the call back functions:

var jsforce = require('jsforce');
var conn = new jsforce.Connection({
  // you can change loginUrl to connect to sandbox or prerelease env.
  loginUrl : 'https://ivytechfoundation--ucidev.my.salesforce.com'
});
conn.login('[email protected]', 'xxxxxxxxTOjhPejiRZ1KWox4AmYOPzqu', function(err, userInfo) {
   console.error('1');
  // if (err) { return console.error(err); }
  console.error(err);
  console.error(userInfo);

  // Now you can get the access token and instance URL information.
  // Save them to establish connection next time.
  console.log(conn.accessToken);
  console.log(conn.instanceUrl);
  // logged in user property
  console.log("User ID: " + userInfo.id);
  console.log("Org ID: " + userInfo.organizationId);
  // ...
});

Any ideas? It never hits '1'

1

There are 1 best solutions below

0
On

There seems to be a bug. I couldn't make it work either, but this works:

conn
      .login(sfUserName, sfPassword + sfToken)
      .then((userInfo) => { // your code here