Model returns a proxy array

I’m following the Full Stack Ember with Rails tutorial from 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:

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

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(),
    // );

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:


I have the application adapter defined as such:

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

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

I also added an application serializer:

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:

Thanks a lot for any feedback on this :hugs: :pray:

1 Like

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. 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:

And if you’re interested there’s also this Ember Data roadmap document:

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.


Thank you for the welcome and your recommendations @dknutsen :slightly_smiling_face:

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

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.

1 Like

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

1 Like

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.

1 Like

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