When I try to create an object such as 'ApexClass', I get the following error:
TypeError: this._createSingle is not a function
At: at Tooling.Connection.insert.Connection.create
This is the code:
conn.login(username, password + securityToken, function(err) {
if (!err) {
const apexBody = [
"public class TestApex {",
" public string sayHello() {",
" return 'Hello';",
" }",
"}"].join('\n');
conn.tooling.sobject('ApexClass').create({
body: apexBody
}, function(err, res) {
if (err) { return console.error(err); }
console.log(res);
});
}
});
I had the same issue with JSforce v 1.9.1. I downgraded to 1.8.5 and was able to use the Tooling API as expected.
I got a similar error this._ensureVersion is not a function and downgrading solved it as well
Upgrading to 1.9.3 will be a better move, as dated now.
Most helpful comment
I had the same issue with JSforce v 1.9.1. I downgraded to 1.8.5 and was able to use the Tooling API as expected.