I have an Ember JS survey application built with a Firebase backend (Emberfire adapter).
The following code works correctly when in development:
if(!(_this.currentModel.get('respondents').contains(thisUser)))
{
thisUser.get('surveysToTake').pushObject(_this.currentModel);
_this.currentModel.get('respondents').pushObject(thisUser);
var userResponseSet = _this.store.createRecord('response-set', {
survey: _this.currentModel,
respondentid: thisUser
});
var respSetSurveyLookupObj = {'surveyId': _this.currentModel.get('id'),
'respSetId': userResponseSet.get('id')};
if(thisUser.get('respSetSurveyLookup'))
{
thisUser.get('respSetSurveyLookup').pushObject(respSetSurveyLookupObj);
} else {
thisUser.set('respSetSurveyLookup', [respSetSurveyLookupObj]);
}
thisUser.save().then(function(){
Ember.RSVP.all([_this.currentModel.save(), userResponseSet.save()]).then(function(){
controller.setProperties({ multipleUsers: '', showAddUsers: false});
});
}).catch(function(msg){console.log(msg);});
}
But the moment I do:
ember build -prod
It throws an error when trying to save the user object. The specific place which throws the error is when I try to add to the respSetSurveyLookup array.
Unfortunately, I'm not able to work my way down the stack trace as the error message is in minified JS code.
So my question is, what might cause a user object save to fail only when an ember build is done? Is this an issue that's arising from Ember CLI (which does the build)? Or is it something to do with the Firebase Emberfire adapter?
Additional info: I'm using Ember CLI 1.13.13, Ember 1.13.11 and Ember data 1.13.11.