question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Interact with RealtimeDB - Error "Run init First"

See original GitHub issue

Hi all,

Trying to get database working with this plugin. I have login abilities working, and I am able to create users and delete and what not.

However, when it comes to working with Firebase RealTimeDB, I cannot get it to interact at all.

I have followed all steps and go as far as removing my code and using the demo code and linking it to my database, however no luck.

I will “run init”, and will get a success message, however when I go to push or query the database, I get a “Error: run init” message.

I have attached code for reference, please let me know if you need anything else.

Kind Regards, Harrison

`var observableModule = require(“data/observable”); var dialogs = require(“ui/dialogs”); var utils = require(“utils/utils”); var fs = require(“file-system”); var firebase = require(“nativescript-plugin-firebase”); const firebaseWebApi = require(“nativescript-plugin-firebase/app”); var platform = require(“platform”);

function econtactFrmViewModel() { var viewModel = observableModule.fromObject({

});

viewModel.registerUser = function () {
    firebase.push(
        '/users',
        {
          'first': 'Eddy',
          'last': 'Verbruggen',
          'birthYear': 1977,
          'isMale': true,
          'address': {
            'street': 'foostreet',
            'number': 123
          }
        }
    ).then(
        function (result) {
            dialogs.alert({
                title: "Working",
                message: result.key,
                okButtonText: "OK"
              });
        },
        function (error) {
            dialogs.alert({
                title: "Login error",
                message: error,
                okButtonText: "OK, pity"
              });
        }
    );
};

return viewModel;

}

module.exports = econtactFrmViewModel;`

`/* In NativeScript, the app.js file is the entry point to your application. You can use this file to perform app-level initialization, but the primary purpose of the file is to pass control to the app’s first module. */

require(“./bundle-config”); const application = require(“application”); const firebase = require(“nativescript-plugin-firebase/app”); firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. persist: true }).then(function (instance) { console.log(“firebase.init done”); }, function (error) { console.log("firebase.init error: " + error); });

application.run({ moduleName: “app-root” });

/* Do not place any code after the application has been started as it will not be executed on iOS. */ `

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
dbilovdcommented, May 6, 2018

@devteam8BT did you find a fix for the issue? If you do can you share with us? I am having the same issue here.

1reaction
devteam8BTcommented, Apr 30, 2018

Will do, just need to remove some files and resources due to IP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase.database is not a function - Stack Overflow
After adding latest database library this questions problem is solved. Updating my code here this.authWithOAuthPopup = function(type) { var deferred = $ ...
Read more >
Retrieving Data | Firebase Realtime Database - Google
In Python and Go, the get() / Get() operation fails by raising an exception in case of an error. If you run the...
Read more >
Firebase Realtime Database With React Native - Medium
If not, check Getting Started With React Native. First step will be to install firebase in your project through npm. npm install firebase...
Read more >
Authentication | React Native Firebase
This module requires that the @react-native-firebase/app module is already ... you're developing your app using iOS, run this command cd ios/ && pod...
Read more >
Firebase Realtimedatabase | Page 4 | B4X Programming Forum
ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:728) ... does not work as expected (that´s the reason why the lib is listed in the "old ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found