EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 448 forks source link

_nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Property is not a constructor #1790

Open maximodanilo opened 3 years ago

maximodanilo commented 3 years ago

I'm getting this error below and couldn't find a solution yet:

LOG from device Pixel 4: com.tns.NativeScriptException: Error calling module function TypeError: _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Property is not a constructor File: (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5048:37)

StackTrace: (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5048:38) at ../node_modules/@nativescript/firebase/mlkit/mlkit-cameraview-common.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5105:30) at webpack_require__(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5117:82) at ../node_modules/@nativescript/firebase/mlkit/mlkit-cameraview.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5472:30) at webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5956:75) at ../node_modules/@nativescript/firebase/mlkit/textrecognition/textrecognition-common.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5979:30) at __webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5810:81) at ../node_modules/@nativescript/firebase/mlkit/textrecognition/index.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:5943:30) at webpack_require__(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:4921:120) at ../node_modules/@nativescript/firebase/mlkit/index.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:4963:30) at webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:854:64) at ../node_modules/@nativescript/firebase/firebase-common.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:1091:30) at __webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/vendor.js:1108:74) at ../node_modules/@nativescript/firebase/firebase.js(file:///data/user/0/org.nativescript.preview/files/app/vendor.js:3563:30) at webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at fn(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:121:20) at (file:///data/user/0/org.nativescript.preview/files/app/bundle.js:162:16) at ./app.js(file:///data/user/0/org.nativescript.preview/files/app/bundle.js:193:30) at webpack_require(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:817:30) at checkDeferredModules(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:44:23) at webpackJsonpCallback(file:///data/user/0/org.nativescript.preview/files/app/runtime.js:31:19) at (file:///data/user/0/org.nativescript.preview/files/app/bundle.js:2:57) at require(:1:266)

TypeError: _nativescript_core__WEBPACK_IMPORTED_MODULE_0__.Property is not a constructor at com.tns.Runtime.runModule(Native Method) at com.tns.Runtime.runModule(Runtime.java:674) at com.tns.Runtime.run(Runtime.java:666) at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6715) at android.app.ActivityThread.access$1300(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

maximodanilo commented 3 years ago

I'd appreciate any help. Thanks

slayer3600 commented 3 years ago

I am seeing this exact error as well. In my case the error occurs when trying to startup an application using NativeScript-Vue with the @nativescript/firebase package. I see someone else has recently posted this in issue #1791 as well.

My import is like this:

const firebase = require("@nativescript/firebase");

Then my init:

firebase.init({
  onMessageReceivedCallback: function(message) {
    console.log("Title: " + message.title);
    console.log("Body: " + message.body);
    // if your server passed a custom property called 'foo', then do this:
    // console.log("Value of 'foo': " + message.data.foo);
  }
})
slayer3600 commented 3 years ago

This was happening to me because I was attempting to use the NativeScript preview app. It says right on the output of the tns preview build script that it will not work because the NativeScript preview app is running an older version of the @nativescript/core library.

Local plugin @nativescript/core differs in major version from plugin in preview app. The local plugin has version ^7.0.3 and the plugin in preview app has version 6.5.0. Some features might not work as expected.
Plugin @nativescript/firebase is not included in preview app on device 07e824f9-d96f-440a-95c7-462e5b85b7d6 and will not work.
Plugin nativescript-socketio is not included in preview app on device 07e824f9-d96f-440a-95c7-462e5b85b7d6 and will not work.

I just started deploying to an emulator and the error went away.

ghost commented 3 years ago

This was happening to me because I was attempting to use the NativeScript preview app. It says right on the output of the tns preview build script that it will not work because the NativeScript preview app is running an older version of the @nativescript/core library.

Local plugin @nativescript/core differs in major version from plugin in preview app. The local plugin has version ^7.0.3 and the plugin in preview app has version 6.5.0. Some features might not work as expected.
Plugin @nativescript/firebase is not included in preview app on device 07e824f9-d96f-440a-95c7-462e5b85b7d6 and will not work.
Plugin nativescript-socketio is not included in preview app on device 07e824f9-d96f-440a-95c7-462e5b85b7d6 and will not work.

I just started deploying to an emulator and the error went away.

Thanks. works fine with device emulator.

jfrcv5 commented 2 years ago

Hello, I'm having the same issue even thoug I'm not using tns preview... only the emulator. Perhaps is a compatibility problem? Currently I'm usign nativescript 8.1.2, @nativescript/firebase 11.1.3, @nativescript/firebase-core 1.1.0-alpha.0 and @nativescript/firebase-dynamic-links 1.1.0-alpha.0. Any help will be greatly appreacited :D