9

Using 3.28 I am hitting an assert deep inside Ember Data when retrieving a relationship on one of my models. I can run the following query just fine:

return this.store.findRecord('project', project_id)

However when I run a subsequent

const monitors = await model.monitors;

in my afterModel() of the route, this assert is triggered.

My Models look pretty standard:

export default class ProjectModel extends Model {
  @attr('string') name;
  @belongsTo('user') creator;
  @attr('date') created;
  @attr('date') changed;
  @hasMany('domain-monitor') monitors;
}

export default class DomainMonitorModel extends Model {
  @belongsTo('project') project;
  @hasMany('page-monitor') pages;
  @attr('string') protocol;
  @attr('string') domain;
  @attr('date') created;
  @attr('date') changed;
}

If someone can point to what is going wrong, I am happy to submit an MR to improve this assert message to hopefully unstuck someone in the future. Thanks!

samuraisam
  • 1,927
  • 1
  • 20
  • 24
  • Assertion sounds as if id or type of the related resource is invalid. Would be helpful if you could include server responses to the fetch requests. Please also include the serializer unless using default `JSONApiSerializer`. – jelhan Sep 25 '21 at 14:07
  • 8
    Do you have Ember Inspector installed in your browser? I've had it cause this error (I don't know why though) – HappyDude Jan 04 '22 at 21:01
  • Thanks @HappyDude. I can confirm Ember Inspector does cause the error as disabling it fixed it. – Happynoff Jan 12 '22 at 02:18

1 Answers1

13

Ember inspector in dev tools seems to cause this sometimes. Disabling it (or even clicking away from the tab in dev tools and refreshing) usually seems to fix the problem for me.

Jeremy Moritz
  • 13,864
  • 7
  • 39
  • 43