The response from a findQuery must be an Array, not undefined


#1

I’m trying to implement search functionality by calling an API /search?q=test. API returns the following object:

{
    "categories" : 
    [
        {
            "id" : 77,
            "name" : "Animals",
            "output" : {}
        }, 
        {
            "id" : 167,
            "name" : "Fish",
            "output" : {
                "image" : {
                    "mimeType" : "image/png",
                    "path" : "/images/fish.png"
                }
            }
        }
    ]
}

Here is my Ember search model:

export default DS.Model.extend({
  categories: DS.hasMany('category')
});

In search controller:

model: function (params) {
  return this.store.find('search', { q: params.q });
}

Getting this error “Assertion Failed: The response from a findQuery must be an Array, not undefined”.

I’m new to Ember but I feel like I need to add a search serializer as well but not sure what to write in there. Or maybe there is something else that is causing this. It looks like to me it should be working fine but it’s not. Any advice?