Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

JS: Error: Uncaught (in promise): Run init() first! #593

Closed
mzainulhassan opened this issue Jan 4, 2018 · 10 comments
Closed

JS: Error: Uncaught (in promise): Run init() first! #593

mzainulhassan opened this issue Jan 4, 2018 · 10 comments
Milestone

Comments

@mzainulhassan
Copy link

i got this error while doing firebase.push()

@EddyVerbruggen
Copy link
Owner

Did you run firebase.init() first?

@mzainulhassan
Copy link
Author

yes

@mzainulhassan
Copy link
Author

mzainulhassan commented Jan 4, 2018

i am working on nativescript and this is what i am doing

const firebase = require("nativescript-plugin-firebase");
firebase.init({
persist: false
}).then(
instance => {
console.log("firebase.init done");
},
error => {
console.log(firebase.init error: ${error});
}
);
firebase.push();

the solution was not clear in this issue: #581

@EddyVerbruggen
Copy link
Owner

I hope you realize your bug report is not too helpful this way. Can you share a repo reproducing the issue? Then also state the steps I need to take to reproduce the issue, and on which platform.

@ITServicesAM
Copy link

In my opinion he calls firebase.push() befor the init function returns.
Try to move your call to firebase.push in the then block of the promise returned by the call to firebase.init().
If your are using angular maybe you have to wrap that call in a NgZone.run call

@mzainulhassan
Copy link
Author

can u provide the code?

@ITServicesAM
Copy link

const firebase = require("nativescript-plugin-firebase");

firebase.init({
    persist: false
}).then(instance => {
    console.log("firebase.init done");
    firebase.push();
}, error => {
    console.log(firebase.init error: ${error});
});

@mzainulhassan
Copy link
Author

still same error

JS: firebase.init done
JS: Unhandled Promise rejection: Run init() first! ; Zone: ; Task: Promise.then ; Value: Run init() first!
JS: Error: Uncaught (in promise): Run init() first!

@giorgiopiatti
Copy link

I think that this is related to #612, which version of nativescript and angular are you using?

@EddyVerbruggen
Copy link
Owner

See #613.

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

No branches or pull requests

4 participants