I get a very opaque error message (opaque in the sense that I donโt have a link for my own source) from the console, Iโm not quite sure where to look, I feel that this is more of an error in the library code, but before posting it to github I just double-check it not for my own mistake.
Problem
The problem is simple, I call this.store.find('player') , hoping to get a list of all the players and then display them in some list, but I donโt even go past the download part. The data is retrieved from the server and looks properly formatted, but after calling the route.model method, something like a failure occurs. And the error message seems to be located somewhere in the code of the ember.js library, and does not indicate anything to my own code.
Server response
The content type, of course, is application/json , and note that the id property is actually _id .
[ { "_id":"55405a5102b4ed623c225e87", "alias":"mikeTest", "__v":0, "scans":[], "createdAt":"2015-04-29T04:13:05.223Z" } ]
Error message
Please note that there is a part of the stack trace pointing to my source, only Ember source. Which made this a pain for debugging.
Error while processing route: leader Cannot read property 'match' of undefined TypeError: Cannot read property 'match' of undefined at Ember.DefaultResolver.extend.podBasedComponentsInSubdir (http://localhost:4200/assets/vendor.js:60138:76) at http://localhost:4200/assets/vendor.js:60190:34 at Array.exports.default.mixin.Mixin.create.find (http://localhost:4200/assets/vendor.js:39572:30) at Ember.DefaultResolver.extend.findModuleName (http://localhost:4200/assets/vendor.js:60188:44) at resolveOther (http://localhost:4200/assets/vendor.js:60051:37) at superWrapper (http://localhost:4200/assets/vendor.js:28141:20) at exports.default.EmberObject.default.extend.resolve (http://localhost:4200/assets/vendor.js:15454:35) at Object.resolve [as resolver] (http://localhost:4200/assets/vendor.js:15217:23) at resolve (http://localhost:4200/assets/vendor.js:12792:29) at Object.Registry.resolve (http://localhost:4200/assets/vendor.js:12336:21)
A source
This ember application is very young, so at the moment the source is very small, but at the moment it is all the relevant source.
Routes
import Ember from 'ember'; import config from './config/environment'; var Router = Ember.Router.extend({ location: config.locationType }); export default Router.map(function() { this.resource('leader'); this.resource('profile'); this.route('loading'); });
Leadership route
The leader has a template and controller, but they are currently empty.
import Ember from 'ember'; export default Ember.Route.extend({ model: function () { return Ember.RSVP.hash({ players: this.get('store').find('player') }); }, });
Player model
import DS from 'ember-data'; export default DS.Model.extend({ alias: DS.attr('string'), createdAt: DS.attr('date'), scans: DS.hasMany('scan'), });
Application adapter
import DS from 'ember-data'; export default DS.RESTAdapter.extend({ namespace: '' });
Application Serial Number
import DS from 'ember-data'; export default DS.RESTSerializer.extend({ primaryKey: function (type) { return '_id'; }, serializeId: function(id) { return id.toString(); } });
Version
I'm not sure if any of the versions are particularly important here.
ember-cli 0.2.3ember-data 1.0.0-beta.16.1Ember 1.11.1
Things i tried
- removing properties from the model, in case the relationship seemed to be a problem (nothing has changed)
- I tried to configure the serializer and adapter for the application (see above), nothing has changed.
- serializer in case the
id field in the response is actually _id .
- tried to update ember data, nothing has changed.