untoldone / bloomapi

Create APIs out of public datasources
https://www.bloomapi.com/documentation/public-data
MIT License
89 stars 29 forks source link

Error with certain NPI "TypeError: Cannot set property 'taxonomy' of undefined" #43

Closed marks closed 10 years ago

marks commented 10 years ago

I am getting the following error when hitting the JSON endpoint of NPI 1003160391 locally. I get a 502 bad gateway error when using the bloomapi.com endpoint.

Will try to look into this myself but want to make sure it's documented here too.

mba62:bloomapi mark$ node make server
2013-12-21T22:14:30.024Z - info: starting bloomapi
2013-12-21T22:14:30.322Z - info: listening on port 3000

XXX/bloomapi/lib/sources/npi/fields.js:146
          set[meta.set - 1][tkey] = tvalue;
                                  ^
TypeError: Cannot set property 'taxonomy' of undefined
    at Object.npiFields.transformField (XXX/bloomapi/lib/sources/npi/fields.js:146:35)
    at Object.npiFields.processRecord (XXX/bloomapi/lib/sources/npi/fields.js:162:12)
    at XXX/bloomapi/lib/sources/npi/fields.js:172:29
    at Array.forEach (native)
    at Object.npiFields.process (XXX/bloomapi/lib/sources/npi/fields.js:171:13)
    at null.callback (XXX/bloomapi/lib/api/server.js:136:25)
    at Query.handleReadyForQuery (XXX/bloomapi/node_modules/pg/lib/query.js:84:10)
    at null.<anonymous> (XXX/bloomapi/node_modules/pg/lib/client.js:148:19)
    at EventEmitter.emit (events.js:117:20)
    at null.<anonymous> (XXX/bloomapi/node_modules/pg/lib/connection.js:97:12)
untoldone commented 10 years ago

Thanks sending for this, looks like it crashes bloomapi -- needs to get fixed :-)

marks commented 10 years ago

My quick hack is to wrap the problem line #146 of fields.js with the following...

      if(set[meta.set - 1] != undefined){
        set[meta.set - 1][tkey] = tvalue;   # old line 146
      }
muniraj65 commented 10 years ago

i am getting the same issue, @marks : i added same code you suggested, not working for me. anyone have fix for it ? Thanks in advance Muniraj S

muniraj65 commented 10 years ago

here is the error detail

2014-02-07T17:34:53.349Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle 2014-02-07T17:35:05.555Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle 2014-02-07T17:35:36.205Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle 2014-02-07T17:35:45.537Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle 2014-02-08T00:14:29.593Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle 2014-02-08T01:21:45.791Z - error: error: column npis.provider_last_name_legal_name does not exist at Connection.parseE (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:537:11) at Connection.parseMessage (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:382:17) at Socket. (/home/ubuntu/bloomapi/node_modules/pg/lib/connection.js:97:20) at Socket.EventEmitter.emit (events.js:95:17) at Socket. (_streamreadable.js:746: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) From previous event: at /home/ubuntu/bloomapi/lib/api/server.js:150:7 at callbacks (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:161:37) at param (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:135:11) at pass (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:170:5) at Object.router (/home/ubuntu/bloomapi/node_modules/express/lib/router/index.js:33:10) at next (/home/ubuntu/bloomapi/node_modules/express/node_modules/connect/lib/proto.js:190:15) at Object.expressInit as handle

marks commented 10 years ago

@muniraj65 - is this happening on a specific NPI or all of them?

muniraj65 commented 10 years ago

Thank you for the response. Happening for all of them what ever I entered in search field What do you think will ba a issue

Thanks mark

On Saturday, 8 February 2014, Mark Silverberg notifications@github.com wrote:

@muniraj65 https://github.com/muniraj65 - is this happening on a specific NPI or all of them?

Reply to this email directly or view it on GitHubhttps://github.com/untoldone/bloomapi/issues/43#issuecomment-34546836 .

Sent from IPhone 5

untoldone commented 10 years ago

@muniraj65 That sounds like it's a different issue. It sounds like the bootstrap code either didn't run or didn't run successfully. Did you make sure to run node make.js bootstrap before running the server? If yes, could you delete the bloomapi db/ rerun it? If you're still seeing the problem, could you open a new issue for it and I'll look into it? @marks I'll get your fix for the original issue in today/tomorrow (sorry for delay!)

untoldone commented 10 years ago

Fixed and deployed to www.bloomapi.com