1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.04k stars 241 forks source link

val.toString() undefined #363

Open alexiskattan opened 10 years ago

alexiskattan commented 10 years ago

For anything the touches the db now, I'm getting this error. Seems to be something new. Perhaps related to a recent release. When I rollback everything except juggling, it works.

2014-01-24T00:22:51 app[web.1]: /app/node_modules/jugglingdb-postgres/lib/postgres.js:213
2014-01-24T00:22:51 app[web.1]:     return escape(val.toString());
2014-01-24T00:22:51 app[web.1]:                       ^
2014-01-24T00:22:51 app[web.1]: TypeError: Cannot call method 'toString' of undefined
2014-01-24T00:22:51 app[web.1]:   at PG.toDatabase (/app/node_modules/jugglingdb-postgres/lib/postgres.js:213:23)
2014-01-24T00:22:51 app[web.1]:   at PG.<anonymous> (/app/node_modules/jugglingdb-postgres/lib/postgres.js:148:32)
anatoliychakkaev commented 10 years ago

We haven't changed postgres for a while. Could you send more stack trace to see jugglingdb part of it. The workaround is simple, but I want to see what actually the reason of this error. And also to confirm, could you try to reproduce issue in some test case? That would be super helpful. Thanks!

On Fri, Jan 24, 2014 at 12:36 AM, alexiskattan notifications@github.comwrote:

For anything the touches the db now, I'm getting this error. Seems to be something new. Perhaps related to a recent release.

2014-01-24T00:22:51 app[web.1]: /app/node_modules/jugglingdb-postgres/lib/postgres.js:213 2014-01-24T00:22:51 app[web.1]: return escape(val.toString()); 2014-01-24T00:22:51 app[web.1]: ^ 2014-01-24T00:22:51 app[web.1]: TypeError: Cannot call method 'toString' of undefined 2014-01-24T00:22:51 app[web.1]: at PG.toDatabase (/app/node_modules/jugglingdb-postgres/lib/postgres.js:213:23) 2014-01-24T00:22:51 app[web.1]: at PG. (/app/node_modules/jugglingdb-postgres/lib/postgres.js:148:32)

— Reply to this email directly or view it on GitHubhttps://github.com/1602/jugglingdb/issues/363 .

alexiskattan commented 10 years ago

Thanks. Here is the full stack trace.

What is the work around for the time being?

SELECT * FROM "User" WHERE "id" = 1 LIMIT 1 [3 ms]
[ERROR] 01:17:09 TypeError

TypeError: Cannot call method 'toString' of undefined
    at PG.toDatabase (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\lib\postgres.js:213:23)
    at PG.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\lib\postgres.js:155:53)
    at Array.forEach (native)
    at PG.toFields (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\lib\postgres.js:153:25)
    at PG.BaseSQL.save (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\sql.js:58:69)
    at PG.updateAttrs [as updateAttributes] (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\sql.js:135:10)
    at ModelConstructor.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\model.js:855:37)
    at ModelConstructor.trigger (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\hooks.js:51:18)
    at ModelConstructor.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\model.js:849:22)
    at ModelConstructor.trigger (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\hooks.js:51:18)
    at C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\model.js:848:18
    at ModelConstructor.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\validations.js:352:21)
    at ModelConstructor.next (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\hooks.js:61:18)
    at ModelConstructor.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\validations.js:351:33)
    at ModelConstructor.trigger (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\hooks.js:51:18)
    at ModelConstructor.Validatable.isValid (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\validations.js:350:18)
    at ModelConstructor.updateAttributes (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\model.js:842:10)
    at C:\Users\alexis\Desktop\proj\app\controllers\editor.coffee:67:24
    at C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\relations.js:253:21
    at ModelConstructor.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\relations.js:225:17)
    at Function.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\model.js:445:9)
    at PG.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb\lib\sql.js:87:9)
    at null.callback (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\lib\postgres.js:60:9)
    at Query.handleReadyForQuery (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\node_modules\pg\lib\query.js:84:10)
    at null.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\node_modules\pg\lib\client.js:159:19)
    at EventEmitter.emit (events.js:117:20)
    at null.<anonymous> (C:\Users\alexis\Desktop\proj\node_modules\jugglingdb-postgres\node_modules\pg\lib\connection.js:97:12)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:736:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at TCP.onread (net.js:526:21)
alexiskattan commented 10 years ago

Any ideas? I'd love to use the new Juggling but this error is blocking. Any pointers on new areas to look?

anatoliychakkaev commented 10 years ago

Should work in latest postgres adapter (0.0.4). Sorry for delay.

On 3 February 2014 17:52, alexiskattan notifications@github.com wrote:

Any ideas? I'd love to use the new Juggling but this error is blocking. Any pointers on new areas to look?

Reply to this email directly or view it on GitHubhttps://github.com/1602/jugglingdb/issues/363#issuecomment-33980509 .

Thanks, Anatoliy Chakkaev