I am using the npm version of n8n and I’m trying to use the JSForce node module in a Script Node (it has more features than the existing Salesforce Nodes).
I already added the module as per the instructions (Configuration | Docs) and I don’t get any errors about missing modules when I run my workflow.
Just to test, I created a Script Node to try to login to Salesforce using JSForce (I have omitted my credentials below for security reasons Document - JSforce):
var jsforce = require('jsforce');
var conn = new jsforce.Connection({
// you can change loginUrl to connect to sandbox or prerelease env.
loginUrl : 'https://test.salesforce.com'
});
conn.login(username, password, function(err, userInfo) {
if (err) { return console.log(err); }
// 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);
// ...
return [
{
json: {
userId: userInfo.id,
orgId: userInfo.organizationId
}
}];
});
When I run this - I get a ‘No Data Returned’ error from N8N, and none of the console log messages in the code show up in either my browser Dev Inspector Console or from my terminal where N8N is running.
It’s like conn.login() is not running at all - what’s causing this? Is N8N blocking something or is there another configuration I have to do?