TypeError: Cannot read property 'constructor' of undefined

1,057 views
Skip to first unread message

Muhammad Al-Syrwan

unread,
Aug 7, 2012, 5:04:09 AM8/7/12
to microco...@googlegroups.com
Hi,

I get the following error when starting the server

microcommunity/providers/db.js:21
if(id.constructor.name != 'ObjectID'){
    ^
TypeError: Cannot read property 'constructor' of undefined
    at Object.exports.normalizeID (/home/mhdsyrwan/node_tests/microcommunity/providers/db.js:21:7)
    at Object.exports.fetch (/home/mhdsyrwan/node_tests/microcommunity/providers/users-provider.coffee:17:19)
    at exports.fetchWithoutPage (/home/mhdsyrwan/node_tests/microcommunity/providers/revisions-provider.coffee:41:31)
    at Collection.findOne (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/collection.js:929:34)
    at Cursor.toArray (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:148:9)
    at Cursor.each (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:188:11)
    at Cursor.nextObject (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:526:35)
    at Cursor.close (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:763:5)
    at Cursor.nextObject (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:526:17)
    at Cursor.each (/home/mhdsyrwan/node_tests/microcommunity/node_modules/mongodb/lib/mongodb/cursor.js:180:12)

Amjad

unread,
Aug 7, 2012, 6:22:51 AM8/7/12
to microco...@googlegroups.com
It is because of old data try resetting your database
--
Sent from my iPad

Muhammad Al-Syrwan

unread,
Aug 7, 2012, 6:33:51 AM8/7/12
to microco...@googlegroups.com

Muhammad Al-Syrwan

unread,
Aug 7, 2012, 8:25:03 AM8/7/12
to microco...@googlegroups.com
I think i found the problem.
providers (especially revisions one) don't check resource before asking for the normalized ID.

Amjad

unread,
Aug 7, 2012, 10:33:57 AM8/7/12
to microco...@googlegroups.com
I'm sorry that was a small bug I didn't notice after I updated the revisions provider

Muhammad Al-Syrwan

unread,
Aug 7, 2012, 1:40:48 PM8/7/12
to microco...@googlegroups.com
No Problem.

I think we should provide a good exception handling with our methods, that will reduce debugging time.

Muhammad Al-Syrwan

unread,
Aug 7, 2012, 1:42:02 PM8/7/12
to microco...@googlegroups.com
There's a problem with coffee script on server too :(, we can't determine the error line on a coffeescript file.

Amjad

unread,
Aug 7, 2012, 3:52:36 PM8/7/12
to microco...@googlegroups.com
I solved that problem in the browser (try to make some syntax error and see what happens in browser console), but I haven't searched yet for how we can solve it on the server, but I think it is quite easy.

Muhammad Al-Syrwan

unread,
Aug 8, 2012, 6:25:15 AM8/8/12
to microco...@googlegroups.com
I don't mean coffeescript assets, i mean coffeescript nodejs server files.
Reply all
Reply to author
Forward
0 new messages