FirebaseExtended / emberfire

The officially supported adapter for using Firebase with Ember

Home Page:https://firebaseopensource.com/projects/firebaseextended/emberfire/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does emberfire v3 realtime database adapter work at all?

maxymczech opened this issue · comments

Good day. I apologize for spamming the issue board. But does the adapter in question actually work at all? I am working on an app that is running Ember 3.4 and latest version of emberfire v2. I would like to update to newer versions of Ember, but I can't get the realtime database adapter in emberfire v3-rc6 to work, it does not create any websocket connection to firebase...

The dummy app in our tests is functional, using CLI 3.13; I haven't tested 3.4 with the latest release candidate. Can you provide more details on the troubles?

Thank you for your response and for your help. What kind of details would be helpful? I have tried updating the NPM package with npm i emberfire@next, which installed the latest release candidate rc6. I then replaced code in app/adapters/application.js with:

import RealtimeDatabaseAdapter from 'emberfire/adapters/realtime-database';
export default RealtimeDatabaseAdapter.extend({
});

The configuration in ENV.firebase worked with emberfire v2, so I didn't change anything there. When I launch the app after these updates, basically nothing happens, there are no warnings neither in terminal output or Chrome console; Chrome inspector shows no attempts to establish WS connection to Firebase. I have tried this with currently installed Ember v3.4 (that is max version I can use in production, because emberfire v2 won't work with Ember 3.5), I have also tried updating Ember to 3.11 (using ember-cli-update, I think I've read somewhere on this issue board that it might help; it didn't).

Again, I am very sorry to bother you with my problem. I would greatly appreciate any thoughts from you, what might I be doing wrong?

I have solved the mistery! The reason was, of course, my stupidity :D In my defense, the migration docs are still not finished. After I have updated emberfire and launched the app, the first screen was login screen. No requests had to be made to the realtime database at this point, that is why in dev console I did not see any connection to Firebase over a Web Socket. And I was unable to log in, becase in emberfire@3.0.0-rc6 authentication must be done differently. In the end, I have used https://github.com/simplabs/ember-simple-auth

@maxymczech are you able to share more details? I just upgraded to 3.0.0-rcX and my torii installation did not work. I am attempting to switch to ember-simple-auth but the app is not loading on start up.

This is basically the code I am using in app/components/login-form.js to authenticate the user:

import Component from '@ember/component';
import { inject as service } from '@ember/service';

export default Component.extend({
  firebaseApp: service(),

  submit() {
    this.get('firebaseApp').auth().then(auth => {
      auth.signInWithEmailAndPassword(this.email, this.password).then(async data => {
        //...
      }, error => {
        //...
      })
    });

    return false;
  }
});

Thanks for sharing and taking the time to reply. Did you use ember simple Auth, or just the native firebase sdk?

Neither native firebase SDK nor Torii worked for me either. But simple auth did.

Ember 3.24.3
Ember Simple Auth 3.1.0
EmberFire 3.0.0-rc.6
Firebase 7.20.0