Search code examples
cordovaionic-frameworkcordova-pluginsionic4

Ionic app crashing with HTTP GET inside of another HTTP GET


I'm using Ionic 4. In order to get around CORS, I'm using this plugin - https://ionicframework.com/docs/native/http/

I make a call:

newurl = '<some google api url>';
this.http.get(newurl, {}, {}).then(data => {
      newurl = '<some other google api url>'
      this.http.get(newurl, {}, {}).then(data2 => {  //<=== this one fails

      }
}

The second GET call is failing. Because the plugin is Cordova, I have to run it on my device (cant use ionic serve), and I dont have any logs - the Sentry logging service isn't sending anything to me.

I know before I upgraded to Ionic 4 and was using the old Http Module, I could chain calls like this - can you not do this now? If so, what am I doing wrong?


Solution

  • I figured out what was going on - there were conflicting Cordova plugins that had different versions of Ok HTTP - so after lining those up, everything worked