SailsJS / MySQL: Unknown column "NaN" in the "list of fields"

I found myself getting

Error (E_UNKNOWN) :: An unexpected error was detected: ER_BAD_FIELD_ERROR: Unknown column "NaN" in the "field list"

I first noticed this at the stage (elastic bean stock). Then they noticed it locally when I make a new one npm install. How can I debug errors? It seems that

Survey.create(params)

is the reason. But I can’t understand why ... paramslook like

{
  "name": "ADDSW",
  "description": "rewgre",
  "url": "https://www.surveymonkey.com/r/my-survey-name?uid=[uid_value]&sid=[sid_value]",
  "image": "https://s3-ap-southeast-1.amazonaws.com/meclub/savVD/35/zx.jpg",
  "points": "111",
  "trackingCode": "EN201510EXFABPSSADON",
  "transaction_partner": "EX",
  "transaction_department": "FAB",
  "transaction_campaign": "ADON",
  "win": ""
}

And the survey model:

var shortid = require('shortid');

module.exports = {
    autoPK: false,

    attributes: {
        id: {
            type: 'string',
            unique: true,
            index: true,
            primaryKey: true,
            defaultsTo: function() {
                return shortid.generate();
            }
        },
        name: {
            type: 'string',
            required: true
        },
        description: {
            type: 'string',
            defaultsTo: ''
        },
        url: {
            type: 'string',
            required: true
        },
        image: {
            type: 'string',
            required: true
        },
        points: {
            type: 'integer',
            required: true
        },

        win: {
            model: 'win'
        },

        trackingCode: {
            type: 'string',
            required: true
        },
        transaction_partner: {
            type: 'string'
        },
        transaction_department: {
            type: 'string'
        },
        transaction_campaign: {
            type: 'string'
        },

        toJSON: function() {
            var obj = this.toObject();
            obj = _.omit(obj, ['createdAt', 'updatedAt', 'transaction_partner', 'transaction_department', 'transaction_campaign']);

            return obj;
        }
    }
}

Does any package seem to be causing an error? But I can’t understand which ...

UPDATE

Just tried deleting everything ^and ~in version numbers in package.jsonso that all the dependencies were installed in the exact versions, but they still do not work ...

+4
1

, win. "win": "" .

+1

Source: https://habr.com/ru/post/1610178/


All Articles