forcedotcom/SalesforceMobileSDK-ReactNative

Error: Android running net.sendRequest returns redirectOnLoad();

Opened this issue · 1 comments

This issue is baffling me. My code works on iOS, but not on Android. In our React Native app, we are fetching v55.0/support/knowledgeArticles to get a list of articles.

Here is my code:

      net.sendRequest(
        '/services/data',
        'v55.0/support/knowledgeArticles?pageSize=5&categories=%7B%27Standard_Knowledge_Article%27%3A%27Featured_Articles%27%7D',
        (success) => {
          setFeaturedArticles(success.articles);
        },
        (error) => {
          console.log(error);
        },
        'GET',
      );

On iOS this is my return:

{
articles: [...],
currentPageUrl: '...',
nextPageUrl: null,
pageNumber: 1
}

However, on Android that same code returns this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <script>
        function redirectOnLoad() {
            if (this.SfdcApp && this.SfdcApp.projectOneNavigator) {
                SfdcApp.projectOneNavigator.handleRedirect('https://domain.sandbox.my.site.com/Domain/s/login?ec=302&startURL=%2FDomain%2Fservices%2Fdatav55.0%2Fsupport%2FknowledgeArticles');
            } else
                if (window.location.replace) {
                    window.location.replace('https://domain.sandbox.my.site.com/Domain/s/login?ec=302&startURL=%2FDomain%2Fservices%2Fdatav55.0%2Fsupport%2FknowledgeArticles');
                } else {
                    window.location.href = 'https://domain.sandbox.my.site.com/Domain/s/login?ec=302&startURL=%2FDomain%2Fservices%2Fdatav55.0%2Fsupport%2FknowledgeArticles';
                }
        }
        redirectOnLoad();
    </script>
</head>
</html>

Please help. Do I have a syntax error? Am I doing something I'm not supposed to be? Any help would be appreciated.

I should note, we are on SF mobile SDK v11.1.0