# Model returns a proxy array

**URL:** https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344
**Category:** Learning Team
**Created:** [November 29, 2023, 11:49am UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344 "2023-11-29T11:49:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/nolo/32/18234_2.png) [@nolo](https://discuss.emberjs.com/u/nolo)
#### Post date: [November 29, 2023, 11:49am UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/1 "2023-11-29T11:49:01Z")

</div>

I’m following the [Full Stack Ember with Rails tutorial](https://www.embercasts.com/course/full-stack-ember-with-rails/) from [embercasts.com](http://embercasts.com). I know it’s pretty old, but it’s also really well crafted as a class. So I follow the tutorial while using ember-cli 5.4 to build the app. This works pretty well overall and seems actually helpful because it also allows me to see previous and current approaches at the same time (which are likely to be mixed in an existing codebase).

I got stuck trying to use the store though. With the tutorial, the Rails backend provides an `authors` route with this data array:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/3X/d/b/db7554104b47872c038d26f2b5a5e70c7e947628.png)

On Ember, the `author` route model calls the route like this:

```auto
import Route from '@ember/routing/route';
import { service } from '@ember/service';

export default class Author extends Route {
  @service store;

  model() {
    // return fetch('http://localhost:3000/authors').then((response) =>
    // response.json(),
    // );
    return this.store.findAll('author');
  }
}

```

That’s the point where I’m stuck. Using `fetch` (as commented out) works. Trying to use `findAll` from the store, I still get the response from the authors route, but when I log the model from the author template, it returns a proxy array:

![image](https://us1.discourse-cdn.com/flex019/uploads/emberjs_public/original/3X/1/d/1dcf6beafcda9c66e8918b5b37583aba8c968b3b.png)

I have the application adapter defined as such:

```auto
import JSONAPIAdapter from '@ember-data/adapter/json-api';

export default class ApplicationAdapter extends JSONAPIAdapter {
  host = 'http://localhost:3000';
}

```

I also added an application serializer:

```auto
import JSONAPISerializer from '@ember-data/serializer/json-api';

export default class ApplicationSerializer extends JSONAPISerializer {}

```

But I have no idea how to adjust those, so the model returns valid data. On the tutorial it apparently still worked by just adding the adapter.

I’m also posting this at length here in #Learning Team because there’s a couple of things that seemed like dead-ends to me trying to get started with ember-data and using the store:

- I get this warning in the console, but I couldn’t find anything in the docs to follow up

- the latest documentation on customizing adapters gives JSONAPIAdapter as the default adapter: [Customizing Adapters - EmberData - Ember Guides](https://guides.emberjs.com/release/models/customizing-adapters/).

- Looking up the adapter on the API docs, it states this is a legacy approach though: [JSONAPIAdapter - 5.3 - Ember API Documentation](https://api.emberjs.com/ember-data/release/classes/jsonapiadapter/) and I should use a handler and requestmanager instead. However, I didn’t find this approach explained in the ember docs

Thanks a lot for any feedback on this 🤗 🙏

---

<div class="post-metadata">

### Author: ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)
#### Post date: [November 29, 2023, 5:59pm UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/2 "2023-11-29T17:59:17Z")

</div>

Hi @nolo, welcome!

I think most of the incongruences you’re finding are because this is an exciting time, Ember Data is being fundamentally decomposed and rewritten to become much more flexible, modern, and even framework agnostic. Unfortunately that means there will be some things that aren’t cohesive or documented quite yet. Hopefully you can stick it out and find a coherent path forward.

The way I see it you have two choices: keep down the path of the. “legacy” patterns which are captured in the guides/tutorials and which should still be supported by modern ember-data, OR try to get a handle on the new patterns and adopt them as much as you can now and not bother with the legacy stuff. You probably want the former path but honestly I’m not the best person to make a recommendation here since I’m not on bleeding edge stuff quite yet.

Your adapter and serializer look fine as far as I can tell. I think it’s expected that you get a proxy array but it should still have valid content, and the template layer should handle that appropriately, so maybe Ember Data is eating it somewhere in the serializer layer. Debugging serializer issues can be kinda gross, which is one of the many things the new ED paradigms will improve.

For deprecations the guides are usually captured here: [Ember.js - Deprecations](https://deprecations.emberjs.com/ember-data/v5.x/). Though this one maybe could use some more fleshing out. Have you tried doing what it says in the deprecation message for now?

If you want to try to triangulate between old and new ember data patterns I’d recommend @runspired 's EmberConf talk: [https://www.youtube.com/watch?v=KpakmlxvT0s](https://www.youtube.com/watch?v=KpakmlxvT0s)

And if you’re interested there’s also this Ember Data roadmap document: [https://github.com/emberjs/data/blob/main/ROADMAP.md](https://github.com/emberjs/data/blob/main/ROADMAP.md)

Lastly I’d recommend checking out the Ember Discord for help on quick and specific questions or if you get stuck on anything in particular.

---

<div class="post-metadata">

### Author: ![nolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/nolo/32/18234_2.png) [@nolo](https://discuss.emberjs.com/u/nolo)
#### Post date: [November 29, 2023, 6:25pm UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/3 "2023-11-29T18:25:59Z")

</div>

Thank you for the welcome and your recommendations @dknutsen 🙂

> [@dknutsen](#):
>
> this is an exciting time, Ember Data is being fundamentally decomposed and rewritten to become much more flexible, modern, and even framework agnostic.

Yeah, it seems a bit difficult to understand all the parts right now. But I agree the direction is exciting!

> [@dknutsen](#):
>
> Your adapter and serializer look fine as far as I can tell.

Thanks, knowing that it’s generally the right setup helped me to dig a bit deeper and I just managed to get it working! Seems like the serializer is doing more out-of-the box now. What I still had to do was simplifying the attributes in the Ember model.

---

<div class="post-metadata">

### Author: ![dknutsen](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/dknutsen/32/16471_2.png) [@dknutsen](https://discuss.emberjs.com/u/dknutsen)
#### Post date: [November 29, 2023, 6:40pm UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/4 "2023-11-29T18:40:13Z")

</div>

Glad you got it working! Definitely don’t hesitate to reach out here or in Discord if you get stuck again!

---

<div class="post-metadata">

### Author: ![runspired](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/runspired/32/18654_2.png) [@runspired](https://discuss.emberjs.com/u/runspired)
#### Post date: [November 30, 2023, 11:02pm UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/5 "2023-11-30T23:02:20Z")

</div>

serializers haven’t really changed in a few majors, but you _would_ need one for the response you posted given the `type` was pluralized. Probably the only thing the serializer is doing for you is normalizing the type to the proper singularized form.

---

<div class="post-metadata">

### Author: ![nolo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/nolo/32/18234_2.png) [@nolo](https://discuss.emberjs.com/u/nolo)
#### Post date: [December 7, 2023, 5:24pm UTC](https://discuss.emberjs.com/t/model-returns-a-proxy-array/20344/6 "2023-12-07T17:24:38Z")

</div>

Thank you @runspired! Indeed had no clue what the serializer is actually doing here 🙂
