ember-data-factory-guy: findRecord giving error "Cannot read property '_internalModel' of undefined"

In our ember app, we are using following versions of ember-data and ember-data-factory-guy.

package.json

"ember-cli": "^1.13.8",
"ember-data": "1.13.9",
"ember-data-factory-guy": "1.13.10",

Note: we are using active-model adapter, not yet migrated to the json-api adapter.

import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend({

Route: item.js

export default Ember.Route.extend(({
  model(params) {
    return this.store.findRecord('item', params.item_id);
  }
});

Its working fine in development mode, but while running test cases, am facing following issue:

Test Case for “display single item” fails with following error:

{
  "message": "Cannot read property '_internalModel' of undefined",
  "name": "TypeError"
}

ember-data/lib/system/stpre/finder.js, fails at return statement

  return promise.then(function (adapterPayload) {
    Ember.assert("You made a request for a " + typeClass.typeClassKey + " with id " + id + ", but the adapter's response did not have any data", adapterPayload);
    return store._adapterRun(function () {
      var requestType = get(serializer, 'isNewSerializerAPI') ? 'findRecord' : 'find';
      var payload = normalizeResponseHelper(serializer, store, typeClass, adapterPayload, id, requestType);
      //TODO Optimize
      var record = pushPayload(store, payload);
      return record._internalModel;
    });

(https://github.com/emberjs/data/blob/master/packages/ember-data/lib/system/store/finders.js#L32)

Are we missing anything here? Can anyone please help me to resolve this? I have tried by upgrading versions to latest, but still facing same issue.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 37

Most upvoted comments

no … I want you to figure it out alittle bit … because you don’t seem to be able to understand what it is like for me … so think more about it

so … pretend you were me and this is all you had to look at … you tell me how you would fix it? cause if you could … maybe you are some kind of genius and I will bow before you.

huh? … what you talkin bout willis?