1
votes

In an ember cli project using firebase, I've installed (using ember install) emberfire and torii. I have put the following configuration in my config/environment.js right after my firebase app url:

torii = {
  sessionServiceName: 'session',
}

And I've put an adapter into app/torii-adapters/application.js:

import Ember from 'ember';
import ToriiFirebaseAdapter from 'emberfire/torii-adapters/firebase';

export default ToriiFirebaseAdapter.extend({
  firebase: Ember.inject.service()
});

However, when I try to get torii's session variable on any route or controller:

this.get("session").fetch().catch(function() {});

the session is undefined:

Error while processing route: app Cannot read property 'fetch' of undefined TypeError: Cannot read property 'fetch' of undefined

I've followed the firebase docs/examples to the best of my knowledge, so I'm not sure what I'm missing. Is another step needed to have torii inject the session variable into all routes and controllers?


The versions in my stack are:

Ember-CLI: 1.13.7
Firebase (package.json): 2.2.9
EmberFire (package.json): 1.5.0
Torii (package.json): 0.5.1

NOTE: I currently have firebase itself working great—all of my models are in sync—so it is not likely the result of a faulty firebase setup. Also, this.get('session') returns undefined anywhere in any route or controller in my app.

1
are you sure about the line torii = { sessionServiceName: 'session' } ? Shouldn't it be torii: { sessionServiceName: 'session' }.user341493

1 Answers

1
votes

Turns out some sort of caching was preventing the config file from being sourced. After restarting my ember server the session was injected properly into the app.