Gravatar for jlynch@sonusnet.com

Question by Jim Lynch, Jun 10, 2016 1:35 PM

REST INFO query - Difference between Object caller and Endpoint caller

We moved our VisualForce application to Production today. One page is not working correctly in Production. I noticed that in our Test org, the REST query has a "caller" of Object but the Production instance has a "caller" of EndpointCaller.

The pages are virtually identical. What determines whether the caller is an Endpoint or Object type ?

Thanks Jim

2 Replies
Gravatar for jlynch@sonusnet.com

Answer by Jim Lynch, Jun 15, 2016 12:44 PM

I could not determine the difference between Test and Production. However, I was able to modify the code so that the links on the page will open in a new tab. This was based on a suggestion by you in another question :-)

Gravatar for mlaporte@coveo.com

Answer by Martin Laporte, Jun 13, 2016 8:52 AM

It should be an EndpointCaller (an internal object). It's created during initialization, in another internal method named createEndpointCaller. I'm not aware of any way that this could be otherwise, unless maybe some custom code overwrites it?

Gravatar for jlynch@sonusnet.com

Comment by Jim Lynch, Jun 13, 2016 1:11 PM

Sorry, I must have been looking at the wrong data. I compared the two pages again today and both are EndpointCaller objects.

But the problem still exists. In both the Test and Prod cases, the data is retrieved correctly and the page is rendered correctly. On the page, there is a link to a document. When clicked, the link should open another browser tab which it does in the Test org.

The REST results look identical.

The JS code in Test and Prod is identical. The main difference is that in Prod, we just installed V2 where as V2 was installed in Test by JF/Ed Quinn. I wonder if we missed something when we installed V2 in Prod.

For example, here is the HTML from the Test page. If I click on this link, it opens a new tab:

<a target="_blank" href="https://support.sonus.net/login.action?os_destination=%2Fdisplay%2FPORTAL%2FGlibc%2BDNS%2Bgetaddrinfo%2BVulnerability%2BCVE-2015-7547?session=00D3B0000008aW7!AR0AQKVhcTh1yJQrrAgEvdfX8.YlH.MHdnFS4giYTd29eviSuVfAdzKxJ4BtfsBdmcgqZig27bN1cvGvDVjWiQaNocLwrRok&amp;domain=https://c.cs50.visual.force.com/services/Soap/u/20.0/00D3B0000008aW7">Latest updates</a>

From the Prod page, here is the link. When I click on it,

<a target="_blank" href="https://support.sonus.net/login.action?os_destination=%2Fdisplay%2FPORTAL%2FGlibc%2BDNS%2Bgetaddrinfo%2BVulnerability%2BCVE-2015-7547?session=00D80000000MWQE!ASAAQGImOaX_2t8IKSuDaZylW7jw_3sdicsqKEU2b4JwoR5czkJecdclg7YDx03NOSMSoTjHE8v9ESWAnbBoIc6CnCTNvVpQ&amp;domain=https://c.na8.visual.force.com/services/Soap/u20.0/00D80000000MWQE">Latest updates</a>

Here is the JS code. In the failure case, the data.totalCount has a value of 1 while in the working case, it is 0. Perhaps that is a clue.

    Coveo.SearchEndpoint.endpoints['default'].search(latestSupportNewsFromWikiQuery).done(function (data){
        if (data.totalCount === 1) {
            var result = _.first(data.results);
            var elem = Coveo.$('<div data-title="'+title+'" data-template-id="LatestNewsQuickViewContent"></div>');
            var options = {};
            result.index = 0;
            var quickview = new Coveo.Quickview(elem.get(0), options, bindings, result);
            quickview.open();
        } else {
            window.open(href, '_blank');   // Open in new tab
            // window.location.href = href;
        }
    });

Thanks Jim

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Jun 13, 2016 2:13 PM

Well my understanding of this code is that it will open in a new tab only if a particular, unknown query returns anything else than exactly 1 result. I have no idea why this is done though --- I'd look for other references to that latestSupportNewsFromWikiQuery to see where it's coming from.

Gravatar for jlynch@sonusnet.com

Comment by Jim Lynch, Jun 13, 2016 5:06 PM

I can control whether a new tab is opened but the issue is that in our V2 Test environment, things are working as expected namely, the page is loaded and contains links to other pages. If I click on a link, a new tab is opened.

The same VF and JS code has been moved into Production and V2 was installed there last week. This particular page behaves a bit differently. When the page is loaded the REST query/results look the same. It is only when i click on the link within the page that I get an error in Production. For some reason, the data.totalCount has a value of 1 in the error (Production) case.

In Production, if i load the page and then click on a link, in the Console log, I see that the REST query was successful and then see ERROR, Assert, Assertion Failed. For some reason, it is taking a different logic path, than in Test.

Gravatar for mlaporte@coveo.com

Comment by Martin Laporte, Jun 14, 2016 10:34 AM

Did you find what that particular query was all about? This is certainly code that is specific to your implementation so it's very hard for me to guess the intent :)

Gravatar for jlynch@sonusnet.com

Comment by Jim Lynch, Jun 15, 2016 4:44 PM

Did not identify the reason why the code didn't work in Production but since I have a workaround, based upon your suggestion, where I simply call window.open on the href that is the link on the page.

Ask a question