Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-3383

Couchbase.ServiceNotAvailableException: Service n1ql is either not configured or cannot be reached.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.4.7
    • None
    • None
    • None
    • 2
    • SDK20

    Description

      I've tried to build and run the following snippet with the credentials replaced:

      using System;
      using System.Threading.Tasks;
      using Couchbase;

      await new CloudExample().Main();

      class CloudExample
      {
      public async Task Main()
      {
      var options = new ClusterOptions

      { // Update these credentials for your Capella instance UserName = "username", Password = "Password!123", }

      ;

      options.KvIgnoreRemoteCertificateNameMismatch = true;
      options.HttpIgnoreRemoteCertificateMismatch = true;
      options.ApplyProfile("wan-development");

      var cluster = await Cluster.ConnectAsync(
      // Update these credentials for your Capella instance
      "<connection-string>",
      options
      );

      // get a bucket reference
      var bucket = await cluster.BucketAsync("<bucket>");

      // get a user-defined collection reference
      var scope = await bucket.ScopeAsync("samples");
      var collection = await scope.CollectionAsync("airline");

      // Call the QueryAsync() function on the scope object and store the result.
      var inventoryScope = bucket.Scope("samples");
      var queryResult = await inventoryScope.QueryAsync<dynamic>("SELECT * FROM airline WHERE id = 10");

      // Iterate over the rows to access result data and print to the terminal.
      await foreach (var row in queryResult)

      { Console.WriteLine(row); }

      }
      }
       
      It throws the Following error:

      Unhandled exception. Couchbase.ServiceNotAvailableException: Service n1ql is either not configured or cannot be reached. Check logs for details.
         at Couchbase.Core.ClusterContext.GetRandomNodeForService(ServiceType service, String bucketName)
         at Couchbase.Core.ServiceUriProvider.GetRandomQueryUri()
         at Couchbase.Query.QueryClient.ExecuteQuery[T](QueryOptions options, ITypeSerializer serializer, IRequestSpan span)
         at Couchbase.Query.QueryClient.QueryAsync[T](String statement, QueryOptions options)
         at Couchbase.Cluster.<>c_DisplayClass35_0`1.<<QueryAsync>g_Func|0>d.MoveNext()
      — End of stack trace from previous location —
         at Couchbase.Core.Retry.RetryOrchestrator.RetryAsync[T](Func`1 send, IRequest request)
         at Couchbase.Cluster.QueryAsync[T](String statement, QueryOptions options)
         at CloudExample.Main() in /Users/dazad/RiderProjects/Program/Program/Program.cs:line 209
         at Program.<Main>$(String[] args) in /Users/dazad/RiderProjects/Program/Program/Program.cs:line 176
         at Program.<Main>(String[] args)

      Attachments

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

        Activity

          People

            jmorris Jeff Morris
            dhirajkumar.azad Dhiraj Kumar Azad
            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