Jsforce: Missing Prototype Functions such as createSingle

Created on 9 Aug 2018  路  7Comments  路  Source: jsforce/jsforce

Keep getting the following error when i run the three code blocks :
error TypeError: this._createSingle is not a function
extension.js:65
at Tooling.Connection.insert.Connection.create (/Users/michaelgarfinkel/Documents/forcecompiler/node_modules/jsforce/lib/connection.js:727:12)
at compile (/Users/*/Documents/**/extension.js:58:29)
at /Users/michaelgarfinkel/Documents/forcecompiler/extension.js:126:17
at /Users/michaelgarfinkel/Documents/forcecompiler/node_modules/jsforce/lib/promise.js:72:9
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

I run this first

        conn = new jsforce.Connection({
            // you can change loginUrl to connect to sandbox or prerelease env.
            loginUrl: 'https://test.salesforce.com',
            version: '43.0'
        });

this second

  conn.login(username, password, function (err, userInfo) {
            if (err) {
                console.error(err);
                reject(err);
            } else {
                // 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);
                // ...
                console.log('conn', conn);            
}
        });

And this third

        return conn.tooling.sobject('ApexClass').create({
            body: apexBody
        }, function (err, res) {
            if (err) { return console.error(err); }
            console.log(res);
        });

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.

All 7 comments

Same issue here!

I'm running into the same issue.

It seems all the 'private' methods (_createSingle, _createParallel, etc...) on the Connection prototype are missing when going through the tooling API. It feels like an unintended omission but I haven't looked at it any further to determine if this is a limitation of the tooling API.

@stomita still getting

this._createSingle is not a function after the PR merge.

ERR TypeError: this._createSingle is not a function ErrorHandler.js:7 at Tooling.Connection.insert.Connection.create (C:\Users\*********\Documents\**********\node_modules\jsforce\lib\connection.js:728:12) at module.exports.SObject.insert.SObject.create (C:\Users\*********\Documents\**********\node_modules\jsforce\lib\sobject.js:62:21)

@stomita Hi, I'm still getting these errors as well

Error: TypeError: this._createSingle is not a function
At: Tooling.Connection.insert.Connection.create

Example code:
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.

@stomita We had the same problem with sfdx and had to downgrade to 1.8.5.

So it seems this issue should not be closed, right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twojoke picture twojoke  路  5Comments

vivinRajagopalan picture vivinRajagopalan  路  6Comments

myke11j picture myke11j  路  4Comments

sureshshamanth picture sureshshamanth  路  6Comments

zestyphresh picture zestyphresh  路  7Comments