Ionic-framework: @ionic-native/http : cordova_not_available

Created on 1 May 2017  路  7Comments  路  Source: ionic-team/ionic-framework

Hello everyone,

Ionic version:
[ ] 1.x
[ ] 2.x
[x] 3.x

I'm submitting a ...
[ ] bug report
[x] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
The application does not start, the message appears:
Uncaught (in promise): cordova_not_available
The message no longer appears if I disable all my calls to the import { HTTP } from '@ionic-native/http';

Expected behavior:
It would be nice if the module does not crash the application

Steps to reproduce:
Using the module : @ionic-native/http and launch the project: ionic serve

Other information:

Cordova CLI: 6.5.0
Ionic Framework Version: 3.1.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
"dependencies": {
    "@angular/animations": "^4.1.0",
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/compiler-cli": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@ionic-native/core": "^3.4.2",
    "@ionic-native/geolocation": "^3.6.1",
    "@ionic-native/http": "^3.6.1",
    "@ionic-native/splash-screen": "3.4.2",
    "@ionic-native/status-bar": "3.4.2",
    "@ionic/storage": "2.0.1",
    "@types/stripe": "0.0.33",
    "ionic-angular": "3.1.1",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "^0.8.5"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.4",
    "typescript": "~2.2.1"
  }

If you could use the http module without going through Cordova, it would be cool, and especially a saving of compilation time

Thank you

Most helpful comment

Okay, thank you for those answers.
excuse me

All 7 comments

You could use @angular/http or fetch() instead of @ionic-native/http:

https://angular.io/docs/ts/latest/guide/server-communication.html

Yes, @duydao is right. The HTTP plugin requires a native device since it is a native plugin. If you want to wrap it in platform.ready() and if (platform.is('cordova') {}, it won't crash your app, but it also won't work on ionic serve. It's best to just use the @angular/http module built in.

Hello! Thanks for opening an issue with us! As this seems like more of a support question i will urge that you ask this question on our forum or on our slack channel. Thanks for using Ionic!

Okay, thank you for those answers.
excuse me

Hi,
I am also using ionic native http plugin but it not working in android but it is working in ios.

@ansarikhurshid786 if you think this is a bug, please open a new issue. If it is a support question, please ask it on the forum.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fdnhkj picture fdnhkj  路  3Comments

brandyscarney picture brandyscarney  路  3Comments

masimplo picture masimplo  路  3Comments

SebastianGiro picture SebastianGiro  路  3Comments

daveshirman picture daveshirman  路  3Comments