codeforamerica / courtbot

Your friendly neighborhood court robot. Provides an api for getting court case information.
ISC License
45 stars 55 forks source link

seems to be an issue with lodash in knex dependencies #10

Open kuanb opened 8 years ago

kuanb commented 8 years ago

$ DATABASE_URL=127.0.0.1:5432 node utils/createQueuedTable.js at createTable 127.0.0.1:5432 /Users/kuanbutts/Documents/cfa/courtbot/node_modules/knex/node_modules/lodash/lodash.js:8878 throw new TypeError(FUNC_ERROR_TEXT); ^

TypeError: Expected a function at Function.rest (/Users/kuanbutts/Documents/cfa/courtbot/node_modules/knex/node_modules/lodash/lodash.js:8878:15) at Object.knex.schema.(anonymous function) as createTable at createTable (/Users/kuanbutts/Documents/cfa/courtbot/utils/createQueuedTable.js:11:22) at Object. (/Users/kuanbutts/Documents/cfa/courtbot/utils/createQueuedTable.js:25:1) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Function.Module.runMain (module.js:467:10) at startup (node.js:136:18)

kuanb commented 8 years ago

Problem coming from knex.js loc 78: return SchemaInterface[key].apply(schemaBuilder, _.rest(arguments));

arguments is an object instead of a function in this situation and _.rest() is expecting a function. in this situation, it appears perhaps there is something happening wrt use of a Promise? Logging the arguments var shows { '0': 'queued', '1': [Function] }... So the item is queued perhaps but the thing it is looking for is perhaps arg[1]?

kuanb commented 8 years ago

Wondering if this has anything to do with knex requiring >= older version of lodash and the newer version of lodash just not playing nice with knex. updating knex revealed: Knex:warning - knex.initialize is deprecated, pass your config object directly to the knex module

Next step will be to perhaps replace the initialize tool?

Although that might be its own bag of worms... Looks like the tool used for Courtbot is not even a version listed in the docs at this pt (0.5 when they start at 0.6... !!!)

Upgrading – 0.8.x -> 0.9 – 0.7.x -> 0.8 – 0.6.x -> 0.7

Also looks like the version of knex used lists as a dependency "lodash": ">=2.4.0", which means that its dl the new lodash, hence all the conflict.