4

We get this error from salesforce (in the sandbox environment) erratically while creating new accounts. Sometimes the account gets created successfully and at other times we get this error:

[Error: Invalid URI "/services/data/v36.0/sobjects/Account"]

We are using jsforce (node.js).

Any ideas why this could be happening? Has anyone else encountered this. I remember this working just fine when I first wrote the code a few months ago.

It's not with our data, because sometimes the request has succeeded with the same exact data and at other times it has failed.

Relevant code snippet:

var orgInfo = { Name: 'Test 28 Org',
  Phone: '1111111111',
  POC_First_Name__c: 'test',
  POC_Last_Name__c: '28',
  BillingStreet: '123 Main St',
  BillingCity: 'Fayetteville',
  BillingState: 'GA',
  BillingPostalCode: '30215',
  BillingCountry: 'United States',
  ShippingStreet: '123 Main St',
  ShippingCity: 'Fayetteville',
  ShippingState: 'GA',
  ShippingPostalCode: '30215',
  ShippingCountry: 'United States',
  Preferred_Method_of_Payment__c: 'Purchase Order' }

conn.sobject('Account').create(orgInfo, function(err, res) {
            if (err || !res.success) { return winston.error('Error occurred during SF account creation ', err, res); }



            // internal code 

        });
  • Where is this code being executed from? Is this a javascript button, in Visualforce, or from an external node.js server? – dsharrison Oct 28 '16 at 15:58
  • It's from a node.js server. All the other requests we do to salesforce go through fine. It's just this one which throws an error and that too only erratically. Again, this is on the salesforce sandbox/test environment. – Prem Govind Oct 28 '16 at 18:55
  • @Kawal, did you ever find a solution to this? I'm facing a similar issue. – Jonathan Van Driessen Jan 31 '17 at 22:50
0

Relative duplicate of overflow question: https://stackoverflow.com/questions/37161453/getting-invalid-uri-services-data-v36-0-queryq-select20id2c20name20fro

That said, the answer from Santosh Kumar does seem to apply here due to the following issue with the jsforce library: https://github.com/jsforce/jsforce/issues/188

Per Santosh's answer in stackoverflow:

Make sure you add two extra lines of code in the node_modules of jsforce's connection.js javascript.:

this.signedRequest = options.signedRequest && parseSignedRequest(options.signedRequest);
  if (this.signedRequest) {
    this.accessToken = this.signedRequest.client.oauthToken;
  ==>  this.version = this.signedRequest.context.environment.version.api || defaults.version;
  ==>  this.instanceUrl = this.signedRequest.client.instanceUrl || this.instanceUrl;
  }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.