question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ionic 4 Http Plugin Crashing App

See original GitHub issue

Bug Report

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (C:\Users\patrick.kelly\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.8
   @angular-devkit/core       : 0.8.1
   @angular-devkit/schematics : 0.8.1
   @angular/cli               : 6.2.1
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.3, (and 8 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\patrick.kelly\AppData\Local\Android\Sdk)
   NodeJS            : v9.3.0 (C:\Program Files\nodejs\node.exe)
   npm               : 5.5.1
   OS                : Windows 10

Describe the Bug When trying to make an API call using Ionic Native HTTP plugin the application crashes and shuts down.

When the application only has the Ionic Native HTTP plugin the plugin works.

This only happens when the Launch Navigator plugin is installed: the Launch Navigator works in isolation and when both are installed.

I have traced the error point to cordova.js line 926: var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);

No console error is written the application just shuts down and the debugger disconnects.

Steps to Reproduce Steps to reproduce the behavior:

1.Create a blank app ionic start myApp blank --type=angular

  1. Install ionic http ionic cordova plugin add cordova-plugin-advanced-http npm install --save @ionic-native/http@5.0.0-beta.17

  2. Install ionic launch navigator ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator npm install --save @ionic-native/launch-navigator@5.0.0-beta.17

  3. add HTTP as a provider in home module

  4. import, inject and use the HTTP in the home.page.ts

  5. call the use of the HTTP from the html of the page

Related Code ** home.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HTTP } from '@ionic-native/http/ngx';
import { HomePage } from './home.page';
@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild([
      {
        path: '',
        component: HomePage
      }
    ])
  ],
  declarations: [HomePage],
  providers: [HTTP]
})
export class HomePageModule {}

**home.page.ts

import { Component } from '@angular/core';
import { HTTP } from '@ionic-native/http/ngx';
@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  constructor(
    private http: HTTP
  ) {
  }
  getStuff() {
       this.http.get('https://www.google.co.uk', null, null).then((success) => alert('success'), (error) => alert('error'));
  }
}

**home.page.html

<ion-header>
 <ion-toolbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-toolbar>
</ion-header>
<ion-content padding>
  The world is your oyster.
  <p>If you get lost, the <button (click)="getStuff()" >Get Stuff</button> will be your guide.</p>
</ion-content>

Expected Behavior I would expect the application to make the api call, not crash and close.

Additional Context Please let me know if I should post this on another Github repo.

I have tried the HTTP plugin in conjunction with the camera plugin and both plugins work correctly here.

When I am adding and removing the plugins I always remove them from the config.xml and remove both the platforms and plugins folder from my workspace

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
maronskicommented, Sep 20, 2018

I’m also using LaunchNavigator feature in my app and as I tried to use Native Http using cordova-plugin-advanced-http it crashes the app.

Any solution for this?

0reactions
ionitron-bot[bot]commented, Jan 18, 2019

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 Http Plugin Crashing App · Issue #15583 - GitHub
When trying to make an API call using Ionic Native HTTP plugin the application crashes and shuts down. When the application only has...
Read more >
Ionic app crashing with HTTP GET inside of another HTTP GET
The second GET call is failing. Because the plugin is Cordova, I have to run it on my device (cant use ionic serve),...
Read more >
Http ionic native request crashing iOS application but works ...
Hi Folks ,. @ionic-native/http - It crash the application on iOS device, request code is below. Same thing with the post or put...
Read more >
ionic-native/app-center-crashes - npm
Ionic Native - Native plugins for ionic apps. Latest version: 5.36.0, ... in your project by running `npm i @ionic-native/app-center-crashes`.
Read more >
Capacitor 3.3.2 - File permission issues crashing app : r/ionic
I am trying to use file storage to read in files from the camera or photo library. Upon applying the selected camera photo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found