1
votes

I'm building an Ember webapp using Ember CLI build system. I get the below error while trying to fetch all plans from the server API. Any idea what causes it ?

Stack trace:

Error while processing route: index Maximum call stack size exceeded RangeError: Maximum call stack size exceeded
    at new Boolean (native)
    at Boolean.toString (native)
    at Object.typeOf (http://website.com/assets/vendor.js:32058:86)
    at Object.Ember.assert (http://website.com/assets/vendor.js:17478:17)
    at get (http://website.com/assets/vendor.js:29793:13)
    at __exports__.default.Mixin.create.get (http://website.com/assets/vendor.js:45505:16)
    at Ember.DefaultResolver.extend.findModuleName (http://website.com/assets/vendor.js:72622:12)
    at resolveOther (http://website.com/assets/vendor.js:72487:37)
    at superWrapper (http://website.com/assets/vendor.js:31677:22)
    at __exports__.default.EmberObject.extend.resolve (http://website.com/assets/vendor.js:17216:27)

This happens when loading the model for the index route. When I'm not loading the model, everything works fine.

routes/index.js:

import Ember from 'ember';

export default Ember.Route.extend({

    renderTemplate: function(){
            this.render('index-unsubscribed');
    },

    model: function() {
            return this.store.find('plan'); // if I comment this line, works fine
    }
});

router.js snippet:

Router.map(function() {
  this.route('index',           {path: '/'});
});

adapters/application.js:

import DS from 'ember-data';

export default DS.Store.extend({
  revision: 1,
  adapter: DS.RESTAdapter.extend({
    namespace: 'api'
  })
});

app.js:

import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;

var App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver: Resolver
});

loadInitializers(App, config.modulePrefix);

export default App;
1

1 Answers

1
votes

Nevermind, apparently I extended both store and adapter instead of only the adapter inside adapters/application.js. Correct version:

import DS from 'ember-data';

export default DS.RESTAdapter.extend({
  namespace: 'api'
});