trailsjs / trailpack-cache

:package: Cache Trailpack
MIT License
3 stars 5 forks source link

Mongo store not working at all #9

Closed jaumard closed 7 years ago

jaumard commented 8 years ago

My config:

'use strict'

/**
 * Cache Configuration
 * (app.config.cache)
 *
 */
module.exports = {
  stores: [
    {
      name: 'mongo',
      type: 'mongodb',
      host: 'loclahost',
      port: '27017',
      database: 'lisa',
      collection: 'preferencesManager',
      compression: false,
      server: {
        poolSize: 5,
        auto_reconnect: true
      },
      ttl: 0
    },
    {
      name: 'memory',
      type: 'memory',
      max: 100,
      ttl: 60
    }
  ],
  defaults: ['memory', 'mongo']
}

The error:

error: 
 TypeError: Cannot convert undefined or null to object
    at new MongoStore (/Users/jaumard/LisaProjects/lisa-box/node_modules/cache-manager-mongodb/index.js:43:18)
    at MongoStore (/Users/jaumard/LisaProjects/lisa-box/node_modules/cache-manager-mongodb/index.js:31:12)
    at Object.create (/Users/jaumard/LisaProjects/lisa-box/node_modules/cache-manager-mongodb/index.js:17:12)
    at Object.caching (/Users/jaumard/LisaProjects/lisa-box/node_modules/cache-manager/lib/caching.js:20:37)
    at Object.module.exports [as mongodb] (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-cache/api/services/stores/mongodb.js:12:23)
    at _.each.value (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-cache/api/services/CacheService.js:57:64)
    at arrayEach (/Users/jaumard/LisaProjects/lisa-box/node_modules/lodash/lodash.js:522:11)
    at Function.forEach (/Users/jaumard/LisaProjects/lisa-box/node_modules/lodash/lodash.js:9289:14)
    at CacheService.getStores (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-cache/api/services/CacheService.js:53:7)
    at CacheService.getCaches (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-cache/api/services/CacheService.js:36:17)
    at ChatBotService.init (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-chatbot/api/services/ChatBotService.js:84:52)
    at ChatbotTrailpack.initialize (/Users/jaumard/LisaProjects/lisa-box/node_modules/trailpack-chatbot/index.js:45:45)
    at app.after.then (/Users/jaumard/LisaProjects/lisa-box/node_modules/trails/lib/trailpack.js:58:26)
error: The application did not boot successfully.
error: Try increasing the loglevel to "debug" to learn more
maissani commented 8 years ago

Please have a look about that : https://github.com/trailsjs/trailpack-cache/pull/6 We are working on a fix.