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.

Uncaught TypeError: Cannot read property 'initializedRelationships' of undefined version 2.0.10

See original GitHub issue

Version info

DEBUG: -------------------------------
DEBUG: Ember             : 3.8.0
DEBUG: Ember Data        : 3.8.0
DEBUG: Firebase          : 3.9.0
DEBUG: EmberFire         : 0.0.0
DEBUG: jQuery            : 3.3.1
DEBUG: Ember Bootstrap   : 2.6.0
DEBUG: Ember Simple Auth : 1.8.2
DEBUG: -------------------------------

Emberfire installed emberfire@2.0.10

Expected behavior

List all objects

Actual behavior

When try to load all store.findAll('bar').

Uncaught TypeError: Cannot read property ‘initializedRelationships’ of undefined

firebase.js:674 Uncaught TypeError: Cannot read property 'initializedRelationships' of undefined
    at Application.getFirstEmbeddingParent (firebase.js:674)
    at Application.isRecordEmbedded (firebase.js:580)
    at Application.listenForChanges (firebase.js:169)
    at Application.recordWasPushed (firebase.js:140)
    at emberfire.js:44
    at Array.forEach (<anonymous>)
    at Class._emberfireHandleRecordPush (emberfire.js:40)
    at Class._push (emberfire.js:76)
    at Class.superWrapper [as _push] (utils.js:349)
    at promise.then.adapterPayload (-private.js:7263)

When try to save a model. model.save().

TypeError: Cannot read property 'initializedRelationships' of undefined
    at Bar.getFirstEmbeddingParent (firebase.js:674)
    at Bar._getAbsoluteRef (firebase.js:649)
    at Bar.updateRecord (firebase.js:405)
    at Bar.createRecord (firebase.js:385)
    at Ember.RSVP.Promise.resolve.then (-private.js:12802)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
fentechcommented, Mar 13, 2019

@heat I was having this issue the other last week and it was because of a combination of my database rules and the way I was saving my asynchronous relationships. Check out these previous relationships docs: https://github.com/firebase/emberfire/blob/c75d1a4fe461b22be54d86370dac8d43a8c4c991/docs/guide/relationships.md#async.

Also, make sure that you’re referencing the correct model in your hasMany/belongsTo. For instance if you have a comment model that belongsTo a post, but your post model is:

// models/post.js
import DS from 'ember-data';

export default DS.Model.extend({
  comments: DS.hasMany('comment', { async: true, inverse: null })
});

Make sure your DS.hasMany('comment'... is the name of the actual model and not a pluralized version of the model name if that’s not what it is.

1reaction
zoltan-nzcommented, Mar 8, 2019

@heat thanks for your report.

Please note that the latest stable emberfire (v2.0.10) is compatible only with Ember v3.4, if you would like to use the latest ember, please try out the emberfire v3 beta.

More details: https://github.com/firebase/emberfire/pull/553

Please share your experience with the new beta version. Everything works as expected?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'initializedRelationships' of undefined ...
When try to load all store.findAll('bar') . Uncaught TypeError: Cannot read property 'initializedRelationships' of undefined. firebase.js:674 ...
Read more >
Cannot read property 'initializedRelationships' of undefined ...
Implementing a Database - Cannot read property 'initializedRelationships' of undefined - Ember js · Have you tried to build a MCVE instead of ......
Read more >
Cannot read property 'get' of undefined
Hello everyone! I created a purchases controller to take data from user input, but I have an error; routes/purchases.js: import Route from ...
Read more >
Cannot read property 'initializedRelationships' of undefined ...
Coding example for the question Implementing a Database - Cannot read property 'initializedRelationships' of undefined - Ember js-ember.js.
Read more >
ERROR TypeError: Cannot read property title of undefined
HEY, SET YOUR LIKE THERE ! ... Your browser can't play this video. ... Solved: ERROR TypeError : Cannot read property title of...
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