Closed kaerumy closed 9 years ago
@kaerumy Thanks for reporting this, I'm looking into it now.
The error I'm seeing in the logs is as follows:
App 22034 stderr:
App 22034 stderr: /data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/lib/apps/generic_document.js:254
App 22034 stderr: name1 = name1.toLowerCase();
App 22034 stderr:
App 22034 stderr: ^
App 22034 stderr: TypeError: Object Parti Islam Semalaysia,Parti Islam Semalaysia has no method 'toLowerCase'
App 22034 stderr: at sortNames (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/lib/apps/generic_document.js:254:25)
App 22034 stderr: at Array.sort (native)
App 22034 stderr: at Promise.<anonymous> (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/lib/apps/generic_document.js:251:21)
App 22034 stderr: at Promise.<anonymous> (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
App 22034 stderr: at Promise.emit (events.js:95:17)
App 22034 stderr: at Promise.emit (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
App 22034 stderr: at Promise.fulfill (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
App 22034 stderr: at Promise.resolve (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/node_modules/mongoose/lib/promise.js:108:15)
App 22034 stderr: at Promise.<anonymous> (/data/vhost/popit.mysociety.org/popit-2015-04-29T15-47-08/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
App 22034 stderr: at Promise.emit (events.js:95:17)
It's caused by this organization - https://sinar-malaysia.popit.mysociety.org/api/v0.1/organizations/556c76528aaf69205fde4d83 - whose name
property is an array of strings, rather than just a plain string. If you update this record so the name is just a string then that should fix the error.
Hope that helps!
Solved thanks a lot.
Great, glad you managed to fix it :smiley:
PopIt should really handle problems like this more gracefully, though — so perhaps this should be left open? Or is it already covered by another ticket?
@tmtmtmtm Yep fair point, I've opened https://github.com/mysociety/popit/issues/845 for handling errors like these better.
https://sinar-malaysia.popit.mysociety.org/organizations
Possibly due to a null field in organization or bad data entered via API, but we cannot debug without traceback.