apache/couchdb-docker

Partitioned key not working with Docker image of CouchDB

Closed this issue · 3 comments

I'm using Loopback 4 and trying to run migrate option. When using local docker image of CouchDB, it throws following error:

'Invalid key partitioned for this request.'

Here's the full error message:

name: 'Error',
  error: 'invalid_key',
  reason: 'Invalid key partitioned for this request.',
  scope: 'couch',
  statusCode: 400,
  request: {
    method: 'post',
    headers: { 'content-type': 'application/json', accept: 'application/json' },
    uri: 'http://localhost:5984/auth-clients/_index',
    body: '{"index":{"fields":[{"loopback__model__name":"asc"}]},"partitioned":false,"ddoc":"LBModel__auth_clients__LBIndex__loopback__model__name_index","name":"loopback__model__name_index","type":"json"}',
    qsStringifyOptions: { arrayFormat: 'repeat' }
  },
  headers: {
    uri: 'http://localhost:5984/auth-clients/_index',
    statusCode: 400,

The partitioned database feature isn't in a released version of CouchDB, so unless you're building a container yourself from source, this is likely because the feature is not available. Loopback could detect this by testing the features array advertised by the root endpoint (http://localhost:5984/).

Thanks @willholley , It seems that "partitioned" is supported by latest version (
3.0) of CouchDB and here's the documentation link for that:
https://docs.couchdb.org/en/master/partitioned-dbs/index.html#
As you mentioned, the endpoint (http://localhost:5984) gives me following in features array:["pluggable-storage-engines","scheduler"]
Neither Cloudant and nor CouchDB docker images support "partitioned" database, so I think I'll have to use the older version of loopback connector for now and wait for this feature to be available with any of the docker images.

This will be resolved when 3.0.0 releases shortly. I'm going to close this for now; keep an eye out for 3.0.0, probably mid-next week.