Closed msureshmewara closed 2 months ago
Hi @msureshmewara,
It looks like the error originates in File: (file: src/webpack:/june_5/webpack/bootstrap:27:0)
. Any chance you know what that line is doing?
@DellaBitta : "@nativescript/webpack": "5.0.21", - Its a webpack file
Perhaps this is where it's complaining about?
System.err: ./node_modules/@grpc/grpc-js/build/src/logging.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/logging.js:37:43)
Can you check node_modules/@grpc/grpc-js/build/src/logging.js:37:43
and let us know what it is?
The closest thing I can find is this, and if that's giving you Cannot read property 'env' of undefined
, it means that process
was undefined
for some reason. (this code in grpc has been there for 3 years, and I doubt it's the culprit).
@ehsannas : Process.env - process is always undefined.
const verbosityString = process.env.GRPC_NODE_VERBOSITY ?? process.env.GRPC_VERBOSITY ?? '';
Hi @msureshmewara,
This looks to be an error in the build process of your application. It appears that the bundler is bringing in the Node.js version of the Firebase SDK but then executing the build in a non-node environment. You'll need to do some debugging of your app's build pipeline to determine why that might be the case.
@DellaBitta : Thank you :), The error occurs only when I am trying to initialize the firebase/firestore.
initializeApp(this.firebaseConfig); // This function is working fine.
getFirestore(this.app); // Once we call this getting the above error.
I understand, but it appears that the build pipeline is bringing in the node version of Firestore when it shouldn't be.
Hey @msureshmewara. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@msureshmewara if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
Operating System
14.1.1 (23B81)
Browser Version
601
Firebase SDK Version
10.1.0
Firebase SDK Product:
Firestore
Describe your project's tooling
Restarting application on device emulator-5554... System.err: An uncaught Exception occurred on "main" thread. System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'env' of undefined System.err: File: (file: src/webpack:/june_5/webpack/bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@grpc/grpc-js/build/src/logging.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/logging.js:37:43) System.err: at webpack_require__(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/metadata.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/metadata.js:20:18) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/call-credentials.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/call-credentials.js:20:19) System.err: at __webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/index.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/index.js:20:27) System.err: at webpack_require__(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@firebase/firestore/dist/index.node.mjs(file:///data/data/org.nativescript.june5/files/app/vendor.js:97233:71) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/item/items.component.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:341:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app-routing.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:184:79) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:239:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:34:73) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at __webpack_exec(file:///data/data/org.nativescript.june5/files/app/bundle.js:525:39) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:189) System.err: at webpack_require__.X(file: src/webpack:/june_5/webpack/runtime/startup entrypoint:6:0) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:47) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:531:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'env' of undefined System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'env' of undefined System.err: File: (file: src/webpack:/june_5/webpack/bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@grpc/grpc-js/build/src/logging.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/logging.js:37:43) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/metadata.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/metadata.js:20:18) System.err: at __webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/call-credentials.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/call-credentials.js:20:19) System.err: at webpack_require__(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/index.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/index.js:20:27) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@firebase/firestore/dist/index.node.mjs(file:///data/data/org.nativescript.june5/files/app/vendor.js:97233:71) System.err: at __webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/item/items.component.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:341:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app-routing.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:184:79) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:239:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:34:73) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at webpack_exec(file:///data/data/org.nativescript.june5/files/app/bundle.js:525:39) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:189) System.err: at webpack_require.X(file: src/webpack:/june_5/webpack/runtime/startup entrypoint:6:0) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:47) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:531:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'env' of undefined System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6717) System.err: at android.app.ActivityThread.access$1300(ActivityThread.java:237) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:223) System.err: at android.app.ActivityThread.main(ActivityThread.java:7656) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: TypeError: Cannot read property 'env' of undefined System.err: File: (file: src/webpack:/june_5/webpack/bootstrap:27:0) System.err: System.err: StackTrace: System.err: ./node_modules/@grpc/grpc-js/build/src/logging.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/logging.js:37:43) System.err: at webpack_require__(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/metadata.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/metadata.js:20:18) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/call-credentials.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/call-credentials.js:20:19) System.err: at __webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@grpc/grpc-js/build/src/index.js(file: src/webpack:/june_5/node_modules/@grpc/grpc-js/build/src/index.js:20:27) System.err: at webpack_require__(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./node_modules/@firebase/firestore/dist/index.node.mjs(file:///data/data/org.nativescript.june5/files/app/vendor.js:97233:71) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/item/items.component.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:341:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app-routing.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:184:79) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/app/app.module.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:239:77) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at fn(file: src/webpack:/june_5/webpack/runtime/hot module replacement:61:0) System.err: at ./src/main.ts(file:///data/data/org.nativescript.june5/files/app/bundle.js:34:73) System.err: at webpack_require(file: src/webpack:/june_5/webpack/bootstrap:24:0) System.err: at __webpack_exec(file:///data/data/org.nativescript.june5/files/app/bundle.js:525:39) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:189) System.err: at __webpack_require__.X(file: src/webpack:/june_5/webpack/runtime/startup entrypoint:6:0) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:526:47) System.err: at (file:///data/data/org.nativescript.june5/files/app/bundle.js:531:3) System.err: at require(:1:266) System.err: System.err: System.err: TypeError: Cannot read property 'env' of undefined System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:689) System.err: at com.tns.Runtime.run(Runtime.java:681) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6712) System.err: ... 8 more Successfully synced application org.nativescript.june5 on device emulator-5554.
Describe the problem
{ "name": "june_5", "main": "./src/main.ts", "version": "1.0.0", "private": true, "dependencies": { "@angular/animations": "~12.0.0", "@angular/common": "~12.0.0", "@angular/compiler": "~12.0.0", "@angular/core": "~12.0.0", "@angular/forms": "~12.0.0", "@angular/platform-browser": "~12.0.0", "@angular/platform-browser-dynamic": "~12.0.0", "@angular/router": "~12.0.0",
}, "devDependencies": { "@angular/compiler-cli": "~12.0.0", "@angular-devkit/build-angular": "~12.1.2", "@nativescript/android": "8.1.1", "@nativescript/ios": "8.3.3", "@nativescript/types": "~8.0.0", "@nativescript/webpack": "5.0.21", "@ngtools/webpack": "12.1.4", "@types/jasmine": "3.9.1", "karma": "6.3.9", "karma-jasmine": "4.0.1", "karma-nativescript-launcher": "0.4.0", "karma-webpack": "5.0.0", "babel-cli": "^6.26.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-preset-env": "^1.6.1", "typescript": "4.2.3" }, "readme": "NativeScript Application", "ignoreMissingDependencies": "true" }
Steps and code to reproduce issue
Create a Nativescript version 8 or above Application. install - npm install firebase. //intilize the SDK this.app = initializeApp(this.firebaseConfig);
Then call the below function const db = getFirestore(this.app);