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

N1QL queries not working on non-prod environment

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • backlog-3.0
    • 3.4.8
    • None
    • None
    • Non-prod
    • 1
    • SDK40, SDK42

    Description

      https://couchbase.slack.com/archives/CC6GX1CJJ/p1689145305271009

      *While running a N1QL query on non-prod cluster I'm getting the following SSL Error:
      (This works fine on prod cluster)*

       System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
      ---> Couchbase.Core.Exceptions.RequestCanceledException: The query was canceled.
      ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
      ---> System.Security.Authentication.AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
      at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
      at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
      at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
      at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
      — End of inner exception stack trace —
      at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
      at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
      at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
      at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
      at Couchbase.Query.QueryClient.ExecuteQuery[T](QueryOptions options, ITypeSerializer serializer, IRequestSpan span)
      — End of inner exception stack trace —
      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 CouchbaseDotNetExample_N1qlQuery.Program.Main(String[] args)
      at CouchbaseDotNetExample_N1qlQuery.Program.<Main>(String[] args)
      ----------------------Context Info--------------------------
      {"statement":"[

      {\u0022statement\u0022:\u0022SELECT h.name, h.city, h.state FROM hotel h WHERE h.city = \\u0027San Francisco\\u0027 AND h.state = \\u0027California\\u0027 LIMIT 5\u0022,\u0022client_context_id\u0022:\u002263c26b19-266d-4516-8dd0-116167cd8195\u0022,\u0022query_context\u0022:\u0022default:\\u0060travel-sample\\u0060.\\u0060inventory\\u0060\u0022,\u0022timeout\u0022:\u0022120000ms\u0022}

      ]","clientContextId":"63c26b19-266d-4516-8dd0-116167cd8195","parameters":"{\u0022Named\u0022:{},\u0022Raw\u0022:{},\u0022Positional\u0022:[]}","httpStatus":"RequestTimeout","queryStatus":"fatal","errors":null,"message":null,"retryReasons":null}

      — End of inner exception stack trace —
      at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
      at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
      at Couchbase.Playground.Serverless.Shared.CodeRunner.Run(String codeExample) in /Users/dazad/Dev/Playground/playground-serverless/dotnet/src/Couchbase.Playground.Serverless.Shared/CodeRunner.cs:line 76

      The dotnet code I'm trying to run:

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

      namespace CouchbaseDotNetExample_N1qlQuery
      {
      class Program
      {
      static async Task Main(string[] args)
      {
      var opts = new ClusterOptions().WithCredentials("

      {credentials-username}

      ", "

      {credentials-password}

      ");
      opts.ApplyProfile("wan-development");
      opts.KvIgnoreRemoteCertificateNameMismatch = true;
      opts.HttpIgnoreRemoteCertificateMismatch = true;
      var cluster = await Cluster.ConnectAsync("

      {credentials-connectionString}

      ", opts);
      var bucket = await cluster.BucketAsync("

      {credentials-bucket}

      ");
      var scope = await bucket.ScopeAsync("

      {credentials-scopeName}

      ");

      var query = "SELECT h.name, h.city, h.state FROM hotel h WHERE h.city = 'San Francisco' AND h.state = 'California' LIMIT 5";
      var result = await scope.QueryAsync<dynamic>(query);
      if (result.MetaData is

      {Status: QueryStatus.Success}

      )
      {
      System.Console.WriteLine("Hotel Results:");
      await foreach (var row in result.Rows)
      {
      System.Console.WriteLine($"Hotel:

      {row.name}

      ,

      {row.city}

      ");
      }
      }
      await cluster.DisposeAsync();
      }
      }
      }

      Attachments

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

        Activity

          People

            richard.ponton Richard Ponton
            dhirajkumar.azad Dhiraj Kumar Azad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty