jsforce icon indicating copy to clipboard operation
jsforce copied to clipboard

Tooling API - Can't create objects

Open MoshikEilon opened this issue 7 years ago • 5 comments

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); }); } });

MoshikEilon avatar Dec 02 '18 13:12 MoshikEilon

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.

aust1nz avatar Dec 11 '18 16:12 aust1nz

I got a similar error this._ensureVersion is not a function and downgrading solved it as well

7ynk3r avatar Jul 16 '19 20:07 7ynk3r

Upgrading to 1.9.3 will be a better move, as dated now.

preveenraj avatar Jun 30 '20 15:06 preveenraj

@preveenraj are you staying this is fixed in >1.9.3?

amphro avatar May 06 '21 17:05 amphro

Can confirm that this is still an issue in 2.0.0-beta.19. Unable to use the Tooling API functionality for DML operations, throws the error TypeError: this._ensureVersion is not a function.

superkensington avatar Nov 23 '22 03:11 superkensington

This should be fixed in v3, see: https://github.com/jsforce/jsforce/discussions/1529

cristiand391 avatar Jul 15 '24 19:07 cristiand391