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

Error trying to use server cert

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.1
    • 3.0.8
    • None
    • None
    • 1
    • SDK28: Txn Loop/Rb,PfQueryColl, SDK30: Connect,Txns, SDK34: Txn/RBAC Mgmt./QColl

    Description

      To connect to a cloud instance, I did this:

      cluster = Cluster.connect(
          'couchbases://cb.51bbb323-476e-4354-bec8-5f9b0a67d146.dp.cloud.couchbase.com?certpath=/Users/davidkelly/projects/gerrit/couchbase-python-client/cloudcert.pem',
          ClusterOptions(PasswordAuthenticator('username', 'password'))
      )
      

      and, since I put the path in the connection string, it works.

      However, this fails with a complaint about certpath (note the spelling) not being a valid parameter if I put the cert_path in the PasswordAuthenticator:

      cluster = Cluster.connect(
          'couchbases://cb.51bbb323-476e-4354-bec8-5f9b0a67d146.dp.cloud.couchbase.com',
          ClusterOptions(PasswordAuthenticator('username', 'password', cert_path='/Users/davidkelly/projects/gerrit/couchbase-python-client/cloudcert.pem'))
      )
      

      I think further down, this is not being added to the connect string as it should?

      Attachments

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

        Activity

          The error is:

          couchbase.exceptions.InvalidArgumentException: <Bad/insufficient arguments provided, inner_cause='certpath' is an invalid keyword argument for this function, C Source=(src/bucket.c,1047)>

          Python backtrace at time of error:

          couchbase-python-client/couchbase/cluster.py(456)connect()
          -> return cls(connection_string, options, **kwargs)
          couchbase-python-client/couchbase/cluster.py(439)_init_()
          -> super(Cluster, self)._init_(connection_string=str(self.connstr), _conntype=_LCB.LCB_TYPE_CLUSTER, **self._clusteropts)
          > couchbase-python-client/couchbase_core/client.py(141)_init_()
          -> super(Client, self)._init_(*args, **kwargs)

          reilbert Richard Eilbert added a comment - The error is: couchbase.exceptions.InvalidArgumentException: <Bad/insufficient arguments provided, inner_cause='certpath' is an invalid keyword argument for this function, C Source=(src/bucket.c,1047)> Python backtrace at time of error: couchbase-python-client/couchbase/cluster.py(456)connect() -> return cls(connection_string, options, **kwargs) couchbase-python-client/couchbase/cluster.py(439)_ init _() -> super(Cluster, self)._ init _(connection_string=str(self.connstr), _conntype=_LCB.LCB_TYPE_CLUSTER, **self._clusteropts) > couchbase-python-client/couchbase_core/client.py(141)_ init _() -> super(Client, self)._ init _(*args, **kwargs)

          Fixed by:

          1. passing the updated clusteropts to ClusterOptions.update_connection_string(),
          2. adding 'certpath' to the list of KEYS recognized by ClusterOptions
          3. and removing 'certpath' from the updated options after the call to update_connection_string() (to prevent it from making its way to libcouchbase and causing the InvalidArgumentException).
          reilbert Richard Eilbert added a comment - Fixed by: passing the updated clusteropts to ClusterOptions.update_connection_string(), adding 'certpath' to the list of KEYS recognized by ClusterOptions and removing 'certpath' from the updated options after the call to update_connection_string() (to prevent it from making its way to libcouchbase and causing the InvalidArgumentException).

          People

            reilbert Richard Eilbert
            david.kelly David Kelly
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty