title: React Native project - cannot make API calls with AwsAmplify through custom library
body: <p>I have a react-native app (without expo) called myapp.</p>
  
  <p>I have a private custom package called myapp-core, where I handle AwsAmplify services (Auth, Storage) -  to do login/signOut/etc.</p>
  
  <p>I want to use myapp-core in myapp project, so I added it as a dependency in <code>package.json</code> (<code>"myapp-core": "file:../myapp-core",</code>) and then <code>yarn install</code>.</p>
  
  <p>The problem I’m facing is that when I call <code>myapp-core.authService.login(username, password)</code> from the mobile project, I catch the error:</p>
  
  <blockquote>
    <p>“ { “line”:177826, “column”: 17, “sourceURL”:
    “<a href="http://10.0.2.2:8081/index.delta?platform=android&amp;dev=true&amp;minify=false" rel="nofollow noreferrer">http://10.0.2.2:8081/index.delta?platform=android&amp;dev=true&amp;minify=false</a>”
    } ”</p>
  </blockquote>
  
  <p>From my research, that means my custom library cannot make api calls - but I don’t know exactly.</p>
  
  <p>When I use aws-amplify's Auth object directly in my mobile project, it works.</p>
  
  <p>Hopefully relevant code:</p>
  
  <pre><code>/**=============================**/
  /** myapp/CoreServices.js **/
  
  import { AmplifyService } from “myapp-core";
  
  export default class CoreServices {
  
   constructor() {
  
      AmplifyService.configure();
      const auth = AmplifyService.authService();
  
      auth
        .login(“myusername”, “mypassword”)
        .then(user =&gt; console.warn("success", user))
        .catch(error =&gt; console.warn("error", error));
    }
  }
  
  
  /**=============================**/
  /** myapp-core/AmplifySevice.js **/
  
  import Amplify from 'aws-amplify';
  import AuthService from '../AuthService/AuthService';
  import awsConfigs from '../aws-exports';
  
  class AmplifyService {
  
    static authServiceInstance = null;
    static storageServiceInstance = null;
  
    static configure(config = awsConfigs) {
      if (config === null || config === undefined) {
        throw new Error('AmplifyService must be initialized with Auth and Storage configurations.');
      }
      Amplify.configure({
        Auth: { /*...*/ },
        Storage: { /*...*/ }
      });
    }
  
    static authService() {
      if (!this.authServiceInstance) {
        this.authServiceInstance = new AuthService();
      }
      return this.authServiceInstance;
    }
  
    static storageService() {
      console.warn('storage service');
      //  initialize storage service
      //  return storage service
    }
  }
  </code></pre>