Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-440

Authentication for cross-bucket queries is failing

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • None
    • None

    Description

      Cross-bucket queries should work by providing additional bucket credentials to a bucket instance.

      For example:

      from couchbase.bucket import Bucket
      from couchbase.n1ql import N1QLQuery
       
      bucket = Bucket('couchbase://10.112.150.101/bucket-1', password='password')
      bucket.add_bucket_creds('bucket-1', 'password')
      bucket.add_bucket_creds('bucket-2', 'password')
       
      query = N1QLQuery(
          "SELECT b1.name FROM `bucket-1` b1 "
          "INNER JOIN `bucket-2` b2 on KEYS b1.name "
      )
      query.ad_hoc = False
      query.cross_query = True
       
      result = bucket.n1ql_query(query).execute()
      

      This returns the following error:
      couchbase.exceptions.HTTPError: <RC=0x3B[HTTP Operation failed. Inspect status code for details], HTTP Request failed. Examine 'objextra' for full result, Results=1, C Source=(src/http.c,140), OBJ=ViewResult<rc=0x3B[HTTP Operation failed. Inspect status code for details], value={u'status': u'stopped', u'errors': [

      {u'msg': u'Authorization Failed Keyspace bucket-2 - cause: Authentication failure.', u'code': 10000}

      ], u'results': [], u'metrics':

      {u'elapsedTime': u'926.526\xb5s', u'executionTime': u'876.342\xb5s', u'resultSize': 0, u'resultCount': 0, u'errorCount': 1}

      , u'requestID': u'c4cd8d89-e967-4c18-a12f-985f47500d43', u'signature': {u'name': u'json'}}, http_status=401>>

      Note it's an authentication based issue for bucket-2.

      This was raised on behalf of this forum post: https://forums.couchbase.com/t/cross-bucket-querying-using-python-sdk/14111

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          I was able to get the below code example working and have posted to forum question. I will leave this open to see if it solves poster's issue.

          mike.goldsmith Michael Goldsmith added a comment - I was able to get the below code example working and have posted to forum question. I will leave this open to see if it solves poster's issue.

          People

            mike.goldsmith Michael Goldsmith
            mike.goldsmith Michael Goldsmith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty