question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tooling API - Can't create objects

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
aust1nzcommented, Dec 11, 2018

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.

0reactions
superkensingtoncommented, Nov 23, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can not create Trigger for Custom Object with Tooling Api
I need to write logic for creating triggers for Standard and Custom Objects. It works for Standard Objects. However when I try to...
Read more >
(Tooling Api) Can i create custom field on ApexClass object
In short No, you can't create custom fields via Apex as they are Metadata. However ,there is a workaround which was created by...
Read more >
Tooling API - Salesforce Implementation guides
Use Tooling API to build custom development tools or apps for Lightning Platform applications. Tooling API's SOQL capabilities for many.
Read more >
Tooling API to Retrieve Metadata dependency for ... - YouTube
Tooling API to Retrieve Metadata dependency for Custom objects.This video is in continuation of the below ...
Read more >
Variable does not exist: Contact: Source error on LWC Tooling ...
The CLI does not use the Tooling API which is why you don't see this issue via the CLI. As a workaround, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found