Topic on Project:Support desk

restbase with cassandra on localhost

2
Andy Kent Jr (talkcontribs)

Hi, at the moment I am trying to use restbase with cassandra on localhost. The objective is to end up using Amazon Keyspaces...

The error I am getting is related to options.log not being a function. Does anybody know what I can be doing wrong?

Any help would be appreciated.

Thank you

 /{domain:localhost}/{api:sys}:
   x-modules:
     - path: projects/proxy.yaml
       options:
        backend_host_template: '{{"/{domain}/sys/legacy"}}'
     - spec:
         paths:
           /table:
             x-modules:
               - name: restbase-mod-table-cassandra
                 type: npm
                 options:
                   conf:
                     version: 1
                     hosts: [localhost]
                     defaultConsistency: one
                     domains: /./
                     storage_groups:
                       - name: default.group.local
                         domains: /./

This is the error stack I get:

{"name":"restbase","hostname":"myhost","pid":51052,"level":60,"err":
 {"message":"options.log is not a function","name":"TypeError",
 "stack":
 "TypeError: options.log is not a function
   at Client.client.on (/path/to/restbase/node_modules/restbase-mod-table-cassandra/lib/index.js:107:17)
   at Client.emit (events.js:198:13)
   at Client.log (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:97:8)
   at Client._connectCb (/path/to/restbase/node_modules/cassandra-driver/lib/client.js:406:8)
   at handlerWrapper (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:416:13)
   at tryCatcher (/path/to/restbase/node_modules/bluebird/js/release/util.js:16:23)
   at Promise.fromNode.Promise.fromCallback (/path/to/restbase/node_modules/bluebird/js/release/promise.js:209:30)
   at Client.promiseWrapper (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:415:10)
   at Client.connect (/path/to/restbase/node_modules/cassandra-driver/lib/client.js:384:31)
   at makeClient (/path/to/restbase/node_modules/restbase-mod-table-cassandra/lib/index.js:115:19)
   at RBCassandra.setup (/path/to/restbase/node_modules/restbase-mod-table-cassandra/index.js:210:16)
   at makeRBCassandra (/path/to/restbase/node_modules/restbase-mod-table-cassandra/index.js:226:15)
   at Router._loadModule (/path/to/restbase/node_modules/hyperswitch/lib/router.js:272:26)
   at P.each (/path/to/restbase/node_modules/hyperswitch/lib/router.js:298:25)
   at tryCatcher (/path/to/restbase/node_modules/bluebird/js/release/util.js:16:23)
   at Object.gotValue (/path/to/restbase/node_modules/bluebird/js/release/reduce.js:166:18)"},
 "stack":
 "TypeError: options.log is not a function
   at Client.client.on (/path/to/restbase/node_modules/restbase-mod-table-cassandra/lib/index.js:107:17)
   at Client.emit (events.js:198:13)
   at Client.log (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:97:8)
   at Client._connectCb (/path/to/restbase/node_modules/cassandra-driver/lib/client.js:406:8)
   at handlerWrapper (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:416:13)
   at tryCatcher (/path/to/restbase/node_modules/bluebird/js/release/util.js:16:23)
   at Promise.fromNode.Promise.fromCallback (/path/to/restbase/node_modules/bluebird/js/release/promise.js:209:30)
   at Client.promiseWrapper (/path/to/restbase/node_modules/cassandra-driver/lib/utils.js:415:10)
   at Client.connect (/path/to/restbase/node_modules/cassandra-driver/lib/client.js:384:31)
   at makeClient (/path/to/restbase/node_modules/restbase-mod-table-cassandra/lib/index.js:115:19)
   at RBCassandra.setup (/path/to/restbase/node_modules/restbase-mod-table-cassandra/index.js:210:16)
   at makeRBCassandra (/path/to/restbase/node_modules/restbase-mod-table-cassandra/index.js:226:15)
   at Router._loadModule (/path/to/restbase/node_modules/hyperswitch/lib/router.js:272:26)
   at P.each (/path/to/restbase/node_modules/hyperswitch/lib/router.js:298:25)
   at tryCatcher (/path/to/restbase/node_modules/bluebird/js/release/util.js:16:23)
   at Object.gotValue (/path/to/restbase/node_modules/bluebird/js/release/reduce.js:166:18)",
  "levelPath":"fatal/startup","msg":"Message not supplied","time":"2020-10-24T10:07:32.028Z","v":0}
Andy Kent Jr (talkcontribs)

If I console.log(options), I get

{ conf:
   { version: 1,
     hosts: [ 'localhost' ],
     username: 'cassandra',
     password: 'cassandra',
     defaultConsistency: 'localOne',
     storage_groups: [ [Object] ],
     localDc: 'datacenter1',
     datacenters: [ 'datacenter1' ] },
   templates: undefined,
   logger:
   Logger {
     _sampled_levels: {},
     _logger:
      Logger {
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        _level: 10,
        streams: [Array],
        serializers: [Object],
        src: false,
        fields: [Object] },
     _levelMatcher: /^(trace|debug|info|warn|error|fatal)(?=\/|$)/,
     _componentLoggers: {},
     _traceLogger:
      Logger {
        _events: [Object: null prototype] {},
        _eventsCount: 0,
        _maxListeners: undefined,
        _level: 10,
        streams: [Array],
        serializers: [Object],
        src: false,
        fields: [Object] },
     args: { name: 'restbase' } } }

It seems like this options.log function missing could be a bug? (or maybe the documentation is incomplete)

Reply to "restbase with cassandra on localhost"