Uncaught Error: Assertion Failed: Error: Assertion Failed: The response from a findAll must be an Array, not undefined

Creating a simple ember app and trying to get data using Ember Data. I was using Fixtures before and that worked fine, so I’m pretty sure the problem is related to Ember data.

The callstack is:

Error: Assertion Failed: The response from a findAll must be an Array, not undefined at new Error (native) at Error.Ember.Error (http://sdevelomentdt:8000/vendor/ember/ember.js:844:19) at Object.Ember.assert (http://sdevelomentdt:8000/vendor/ember/ember.js:73:11) at http://sdevelomentdt:8000/vendor/ember-data/ember-data.js:10398:15 at invokeCallback (http://sdevelomentdt:8000/vendor/ember/ember.js:9753:19) at publish (http://sdevelomentdt:8000/vendor/ember/ember.js:9423:9) at Promise.publishFulfillment (http://sdevelomentdt:8000/vendor/ember/ember.js:9843:7) at Object.DeferredActionQueues.flush (http://sdevelomentdt:8000/vendor/ember/ember.js:5893:24) at Object.Backburner.end (http://sdevelomentdt:8000/vendor/ember/ember.js:5984:27) at Object.Backburner.run (http://sdevelomentdt:8000/vendor/ember/ember.js:6023:18) ember.js:3461 Uncaught Error: Assertion Failed: Error: Assertion Failed: The response from a findAll must be an Array, not undefined

I’ve validated the JSON response is valid JSON and conforms to what Ember should be expecteding:

{	
	"todos": [{
		"id": "1",
		"title": "Get Rich Real Quick?",
		"isCompleted": "true" ,
		"showRecord": "true"
	}]
}

Other than that, it’s pretty much boiler plate code to get the data. In the router :

App.Todo =  DS.Model.extend({
               id: DS.attr('integer'),
               title: DS.attr('string'),
               isCompleted: DS.attr('boolean'),
                  showRecord: DS.attr('boolean')
});

return this.store.find('Todo');

You need to camelCase any calls to store. the line:

return this.store.find('Todo')

should be:

return this.store.find('todo');

I am having the same issue. Here’s a screencast demonstrating what I am seeing: 2014-04-13_0933

Any ideas?

Hi,

there can be several things that do this:

I had it when defining a resource route and I did load some complex model with lots of relationships in the beforeModel hook and not in the model hook

hope it helps

**edit

still got that error, but I will tell when I know more.

Ok, as said I loaded lots of data in the ApplicationRoute and did more @store.find(‘model’) on that model on child routes. Changing the code to @store.all(‘model’) in the child routes and only using find in the ApplicationRoute fixed it for me.