Jsforce: Error: Invalid URI "/services/apexrest/....

Created on 25 Aug 2016  路  1Comment  路  Source: jsforce/jsforce

Hi,

Apex Rest request 3 out of 5 requests go through fine and don't fail, but occasionally I receive an "Invalid URI" Error. Why does this error only occur some of the time and not every time? The URI is correct, I've tested it in many other instances, but it continues to occasionally fail with jforce.

var sfUrl = process.env.SF_URL,
sfUsername = process.env.SF_USERNAME,
sfPassword = process.env.SF_PASSWORD,
sfSecurityToken = process.env.SF_TOKEN;

this.sfConn = new jsforce.Connection({
    loginUrl: sfUrl
});

this.sfConn.login(sfUsername, sfPassword + sfSecurityToken, function(err, res) {
    if (err) {
        console.log(new Date() + ': [ERROR] SF LOGIN (' + err + ')');

        if (retryNum > 0) {
            console.log('Retrying...');
            setTimeout(function(){ sfLogin(retryNum - 1, callback); }, 2000);
        } else if (callback) {
            callback(err);
        }

    } else if (callback) {
        callback(err);
    }
});

this.sfConn.apex.get('/' + name, function(err, res) {
if (err) {
console.log(new Date() + ': [ERROR] SF CPT GET API: ' + name + ' (' + err + ')');
console.log(res);
if (retryNum > 0) {
console.log('Retrying...');
setTimeout(function(){ cptGetAPI(name, retryNum - 1, callback); }, 2000);
} else if (callback) {
callback(err);
}

        } else if (callback) {
            callback(err, res);
        }
    });

Thanks,
Tom

question

Most helpful comment

I have a related issue and have also posted this question on stackexchange.

Not sure if its related to jsforce or the API endpoint itself.

The error I get is also erratic and doesn't happen all the times.

The error I get back is:

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

>All comments

I have a related issue and have also posted this question on stackexchange.

Not sure if its related to jsforce or the API endpoint itself.

The error I get is also erratic and doesn't happen all the times.

The error I get back is:

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonDum picture JonDum  路  7Comments

myke11j picture myke11j  路  4Comments

sureshshamanth picture sureshshamanth  路  6Comments

stomita picture stomita  路  5Comments

MarkBolden picture MarkBolden  路  3Comments