mercredi 2 mai 2018

ember error happens only when running in cordova/phonegap

Our ember app runs fine in a regular browser, also on Chrome on an android phone. But when we wrap the same build in Cordova and installs it on an android phone it fails deep inside the ember framework on one particular operation. A store.createRecord operation.

Here is some code that includes the failing operation:

import Ember from "ember";
import DS from 'ember-data';
const { Model, attr} = DS;

export default Model.extend({

    (... declaring some attributes)

    makeActivityExerciseFromExercise: function(store, activity, workoutId)
    {
        var config = {
            (... setting some attributes)
        };

        var ae = store.createRecord('activity-exercise', config);
        return ae;
    },
    ...

Here is the error message and some stacktrace

Uncaught TypeError: Cannot read property '_attributes' of null
    getValue                        @ vendor.js:85081
    set                             @ vendor.js:85200
    computedPropertySet             @ vendor.js:36728
    computedPropertySetWithSuspend  @ vendor.js:36710
    computedPropertySetEntry        @ vendor.js:36688
    Class                           @ vendor.js:50210
    _ClassMixinProps.create         @ vendor.js:50387
    create                          @ vendor.js:21773
    getRecord                       @ vendor.js:76229
    createRecord                    @ vendor.js:79726
    makeActivityExerciseFromExercise @ eea.js:6168

Here is output of the version information at startup:

DEBUG: --------------------------------
DEBUG: Ember      : 3.0.0
DEBUG: Ember Data : 3.0.1
DEBUG: jQuery     : 3.3.1
DEBUG: --------------------------------

This is a hard one to solve. Any help appreciated.




Aucun commentaire:

Enregistrer un commentaire