Re: [loopbackjs] Weird error with model POST and SQL

271 views
Skip to first unread message

Raymond Feng

unread,
Feb 1, 2015, 4:08:04 PM2/1/15
to Pierre Wroblewski, loopb...@googlegroups.com
I assume some of the modules are upgraded.

In your case, the evaluation should be a number. Can you try to fix its value from "1" to 1? We'll investigate why the coercion doesn't happen in your case.

Thanks,
Raymond

Sent from my iPhone 6 Plus

On Feb 1, 2015, at 11:12 AM, Pierre Wroblewski <wroblews...@gmail.com> wrote:

Hi,

I stumbled upon a wierd behaviour with loopback, I'm trying to push a simple model :

{
  "name": "POI",
  "plural": "POIs",
  "base": "PersistedModel",
  "idInjection": true,
  "properties": {
    "name": {
      "type": "string",
      "required": true
    },
    "geopoint": {
      "type": "geopoint",
      "required": false
    },
    "description": {
      "type": "string"
    },
    "type": {
      "type": "string"
    },
    "evaluation": {
      "type": "number",
      "required": false
    }
  },
  "validations": [],
  "relations": {
    "publicEvents": {
      "type": "hasMany",
      "model": "PublicEvent",
      "foreignKey": ""
    },
    "privateEvents": {
      "type": "hasMany",
      "model": "PrivateEvent",
      "foreignKey": ""
    }
  },
  "acls": [],
  "methods": []
}

With this simple code on the POST endpoint : 

{
  "name": "Poi",
  "evaluation": "1"
}

I'm pretty sure it worked fine like yesterday, I didn't change anything but loopback return me this error : 



  • "error": {
    • "name""Error",
    • "status"500,
    • "message""ER_BAD_FIELD_ERROR: Unknown column 'NaN' in 'field list'",
    • "code""ER_BAD_FIELD_ERROR",
    • "errno"1054,
    • "sqlState""42S22",
    • "index"0,
    • "stack""Error: ER_BAD_FIELD_ERROR: Unknown column 'NaN' in 'field list'\ at Query.Sequence._packetToError (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\sequences\\Sequence.js:48:14)\ at Query.ErrorPacket (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\sequences\\Query.js:82:18)\ at Protocol._parsePacket (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\Protocol.js:271:23)\ at Parser.write (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\Parser.js:77:12)\ at Protocol.write (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\Protocol.js:39:16)\ at Socket.<anonymous> (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\Connection.js:82:28)\ at Socket.emit (events.js:95:17)\ at Socket.<anonymous> (_stream_readable.js:765:14)\ at Socket.emit (events.js:92:17)\ at emitReadable_ (_stream_readable.js:427:10)\ --------------------\ at Protocol._enqueue (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\Protocol.js:135:48)\ at PoolConnection.Connection.query (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\Connection.js:185:25)\ at Object.eval [as forward] (eval at recompile (C:\\Users\\Pierre\\AppData\\Roaming\\npm\\node_modules\\strongloop\\node_modules\\strong-agent\\lib\\proxy.js:237:15), <anonymous>:4:32)\ at PoolConnection.eval [as query] (eval at wrap (C:\\Users\\Pierre\\AppData\\Roaming\\npm\\node_modules\\strongloop\\node_modules\\strong-agent\\lib\\proxy.js:193:20), <anonymous>:3:21)\ at runQuery (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\lib\\mysql.js:153:16)\ at F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\lib\\mysql.js:199:7\ at Ping.onPing (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\Pool.js:94:5)\ at Ping.<anonymous> (F:\\Git\\TravelizWebService\\node_modules\\loopback\\node_modules\\continuation-local-storage\\context.js:74:17)\ at Ping.b [as _callback] (domain.js:183:18)\ at Ping.Sequence.end (F:\\Git\\TravelizWebService\\node_modules\\loopback-connector-mysql\\node_modules\\mysql\\lib\\protocol\\sequences\\Sequence.js:96:24)"
    }

Any idea what can be the problem?

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pierre Wroblewski

unread,
Feb 1, 2015, 5:14:08 PM2/1/15
to loopb...@googlegroups.com, wroblews...@gmail.com
Unfortunately this error was my fault, I forgot to change the type of a field, I deleted my post but too late it seems.
Reply all
Reply to author
Forward
0 new messages