Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"TypeError: Object(...) is not a function" when importing to module #57

Open
Zerokk opened this issue Feb 19, 2019 · 4 comments
Open

"TypeError: Object(...) is not a function" when importing to module #57

Zerokk opened this issue Feb 19, 2019 · 4 comments

Comments

@Zerokk
Copy link

Zerokk commented Feb 19, 2019

After installing Stripe and the Cordova plugin, and setting up Stripe as a provider in any module, the app won't load and will output the message:

TypeError: Object(...) is not a function

It doesn't matter if I put is as a provider to the main module, or the components module for lazyloading components, or wherever. It just will output this error and nothing more. Something's definitely not fine here.

Some data about my setup:

Node v11.8
Dependencies:

{
"dependencies": {
    "@agm/core": "^1.0.0-beta.5",
    "@angular/common": "~7.2.3",
    "@angular/core": "~7.2.3",
    "@angular/forms": "~7.2.3",
    "@angular/http": "~7.2.3",
    "@angular/platform-browser": "~7.2.3",
    "@angular/platform-browser-dynamic": "~7.2.3",
    "@angular/router": "~7.2.3",
    "@ionic-native/core": "5.0.0",
    "@ionic-native/geolocation": "^5.0.0",
    "@ionic-native/spinner-dialog": "^5.0.0",
    "@ionic-native/splash-screen": "5.0.0",
    "@ionic-native/status-bar": "5.0.0",
    "@ionic-native/stripe": "^4.20.0",
    "@ionic/angular": "4.0.0",
    "@types/parse": "^2.1.0",
    "chart.js": "^2.7.3",
    "cordova-android": "7.1.4",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-native-spinner": "^1.1.3",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-stripe": "1.5.3",
    "cordova-plugin-whitelist": "^1.3.3",
    "core-js": "^2.5.3",
    "crypto-js": "^3.1.9-1",
    "moment": "^2.24.0",
    "ng2-charts": "^1.6.0",
    "parse": "^2.1.0",
    "rxjs": "6.4.0",
    "typescript": "^3.1.6",
    "zone.js": "^0.8.29"
  }
}

Plugins:
"plugins": { "cordova-plugin-geolocation": { "GEOLOCATION_USAGE_DESCRIPTION": "To locate you" }, "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-native-spinner": {}, "cordova-plugin-stripe": {} },

@ihadeed
Copy link
Member

ihadeed commented Feb 19, 2019

The details you shared aren't enough to know where the issue is coming from.

But looking at your package.json I do see that you installed @ionic-native/[email protected] while the rest of your Ionic Native packages are using ^5.0.0. You need everything to be ^5.0.0 as v5 isn't reverse compatible that way.

@Zerokk
Copy link
Author

Zerokk commented Feb 19, 2019

But, does stripe have a version 5? I need the v5 ionic native packages if I want some of the stuff of the app to work, and I still can't be able to use this native library no matter what I do. Mind that the app breaks only when I setup it as a provider for any, literally any given module. That's not normal, especially when the error thrown makes so little sense.

@noctivityinc
Copy link

I have the exact same issue and I am running 5.1.0 of stripe. When I do an npm install it tells me I need to install rxjs^6.3, but other plugins require 5.X of rxjs - not sure if that makes a difference.

I also wrapped the call in a platform.ready block but that didnt make a difference.

I'd use stripe.js directly with elements but ionic appears to block stripe.js on iOS for production

@levarberry
Copy link

Downgrade everything in @ionic-native to 4.20.0 v5 is a pre-release .. so it will be unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants