I found that I am getting
Error (E_UNKNOWN) :: Encountered an unexpected error : ER_BAD_FIELD_ERROR: Unknown column 'NaN' in 'field list'
I first noticed this on staging (elastic beanstalk). Then noticed this locally when I do a fresh npm install
. How can I debug whats wrong? It appears that
Survey.create(params)
is the cause. But I cannot figure out why ... params
look 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;
}
}
}
Seems like some package causes the error? But I cannot figure out which ...
UPDATE
Just tried removing all the ^
and ~
in the version numbers in package.json
so all dependencies are installed at exact versions, but it still fails ...
I guess the problem is with the win
attribute. Instead of sending empty string "win": ""
, you may have to eliminate it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With