dittach / loopback-connector-riak

A StrongLoop Loopback framework connector for the Riak database.
MIT License
8 stars 2 forks source link

Failure to get bucket list #4

Open zerebral opened 9 years ago

zerebral commented 9 years ago

The connector fails to get the required bucket list (I think its required by most of the operations performed by the connector?) -

e.g. Trying to create a model instance it fails with the following error -

express:router trim prefix (/comment_likes) from url /comment_likes +29ms express:router router /comment_likes : /api/comment_likes +0ms express:router dispatching POST / +0ms /home/zerebral2/projects/topic_backend/node_modules/loopback-connector-riak/lib/api/all.js:38 if (buckets.indexOf(bucketName) === -1) return callback(null, false); ^ TypeError: Cannot read property 'indexOf' of undefined at /home/zerebral2/projects/topic_backend/node_modules/loopback-connector-riak/lib/api/all.js:38:18 at meta.callback (/home/zerebral2/projects/topic_backend/node_modules/loopback-connector-riak/node_modules/riak-js/lib/http-client.js:202:48) at IncomingMessage. (/home/zerebral2/projects/topic_backend/node_modules/loopback-connector-riak/node_modules/riak-js/lib/http-request.js:146:7) at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at /home/zerebral2/projects/topic_backend/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31 at process._tickDomainCallback (node.js:381:11) at process. (/home/zerebral2/projects/topic_backend/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/index.js:19:15)

Does the connector assume the required buckets will be pre-created in Riak for this to work?

Can it not create the buckets on the fly - just pass on the POST request to Riak and Riak will create the required underlying bucket?

zerebral commented 9 years ago

BTW The connector datasource is configured with the HAProxy port (8888 in this case) that has Riak nodes listening on HTTP port at the back. If the connector is tried with the PB port all requests simply time out - so I guess HTTP port is the right one to use?

Also the curl request is able to fetch the bucket list okay - curl http://localhost:8888/buckets?buckets=true
{"buckets":["contributors","rekon","TestModel","comment_likes","food","locations","topic_likes","my_bucket"]} (This again is HAProxy port)

And the required "comment_likes" bucket is already available with Riak.

onyxrev commented 9 years ago

@zerebral Please give version 0.1.1 a try. I think this was an issue with Node v0.12, which we weren't on just yet. I removed the bucket check.

onyxrev commented 9 years ago

@zerebral We hit version 1.0.0, which includes a lot of fixes. Care to give it another try?

Note that we're using the official Basho client now and you need to change your datasources file. You no longer need a frontend proxy.