Service n1ql not available

Hi,
I downloaded last master version of .net SDK 3.0 client to use the dependency injection option that not available for SDK version 3.0. I compiled and published both projects (Couchbase & Couchbase.Extensions.DependencyInjection).
When I use the Couchbase (without using Couchbase.Extensions.DependencyInjection) I get error on Query:
message=" Service n1ql not available".
When i am using the published version of couchbase-net-client it’s working.
The code quit simple:
var cluster = await Cluster.ConnectAsync(“couchbase://1xx.x6.7x.1x”, clusterOptions);
var bucket = await cluster.BucketAsync(“BucketName”);
var collection = bucket.DefaultCollection();
var qry = $@“select c.* from BucketName as c where type = ‘contact’
and c.timestamp >= ‘{DateTime.Now.AddDays(-30)}’ order by c.timestamp;”;
var results = await cluster.QueryAsync(qry, new Couchbase.Query.QueryOptions()).ConfigureAwait(false);

Can’t understand why?

1 Like

@Shlomo_Shs - it could be related to this bug or this forum issue. We’ll look into it and see what we find.

-Jeff

I’m on version 3.0.1 from nuget and I’m still having this issue…

@coreyponsv -

Can you post logs?

@jmorris I’d be happy to, which log files are helpful for this?

@coreyponsv -

Install Serilog.Extensions.Logging.File and then:

 IServiceCollection serviceCollection = new ServiceCollection();
 serviceCollection.AddLogging(builder => builder.AddFilter(level => level >= LogLevel.Debug) );

 var loggerFactory = serviceCollection.BuildServiceProvider().GetService<ILoggerFactory>();
 loggerFactory.AddFile("Logs/myapp-{Date}.txt", LogLevel.Debug);

 var clusterOptions = new ClusterOptions().WithCredentials("user", "password").WithLogging(loggerFactory); 

That should write the sdk log to file.

-Jeff

@jmorris Thanks for that, for some reason I was thinking couchbase log files

Anyway this is what I’ve got:

2020-05-19T17:32:09.9259601-05:00 [INF] There was an error attempting to resolve hosts using DNS-SRV - “Non-Existent Domain” (9daf8ee2)
2020-05-19T17:32:09.9873851-05:00 [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-05-19T17:32:09.9886399-05:00 [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-05-19T17:32:10.1958015-05:00 [DBG] Executing op Helo with key “{"i":"7430bb5724078734/0000000000000001","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 4. (763fc9b0)
2020-05-19T17:32:10.1958015-05:00 [DBG] Executing op Helo with key “{"i":"7430bb5724078734/0000000000000002","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 3. (763fc9b0)
2020-05-19T17:32:10.2343092-05:00 [DBG] Completed executing op Helo with key “{"i":"7430bb5724078734/0000000000000002","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 3 (1b7c92d9)
2020-05-19T17:32:10.2343092-05:00 [DBG] Completed executing op Helo with key “{"i":"7430bb5724078734/0000000000000001","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 4 (1b7c92d9)
2020-05-19T17:32:10.2505387-05:00 [DBG] Executing op GetErrorMap with key “” and opaque 7. (763fc9b0)
2020-05-19T17:32:10.2505387-05:00 [DBG] Executing op GetErrorMap with key “” and opaque 8. (763fc9b0)
2020-05-19T17:32:10.2607010-05:00 [DBG] Completed executing op GetErrorMap with key “” and opaque 7 (1b7c92d9)
2020-05-19T17:32:10.2607010-05:00 [DBG] Completed executing op GetErrorMap with key “” and opaque 8 (1b7c92d9)
2020-05-19T17:32:10.3620889-05:00 [INF] v=HXKpbBmCvCvP6hJDubBwF864oXc= (122a81ea)
2020-05-19T17:32:10.3620889-05:00 [INF] v=pbkP1/6Gi6m/tl12QAIu1yIwXYk= (abbebcf0)
2020-05-19T17:32:10.3680373-05:00 [DBG] Starting connection pool monitor on “127.0.0.1:11210”, idle timeout 00:01:00, back pressure threshold 8 (41924b22)
2020-05-19T17:32:10.3682040-05:00 [DBG] Connection pool for “127.0.0.1:11210” initialized with 2 connections. (ee89feb4)
2020-05-19T17:32:10.3711737-05:00 [DBG] Executing op GetClusterConfig with key “” and opaque 14. (763fc9b0)
2020-05-19T17:32:10.3768883-05:00 [DBG] Server returned BucketNotConnected for op GetClusterConfig with key “” and opaque 14. (adc54a33)
2020-05-19T17:32:10.3838348-05:00 [DBG] Added “127.0.0.1:11210” (5363a1fe)
2020-05-19T17:36:43.7728108-05:00 [INF] There was an error attempting to resolve hosts using DNS-SRV - “Non-Existent Domain” (9daf8ee2)
2020-05-19T17:36:43.8348455-05:00 [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-05-19T17:36:43.8393991-05:00 [DBG] Setting TCP Keep-Alives using SocketOptions - enable keep-alives True, time 00:01:00, interval 00:00:01. (d66a37aa)
2020-05-19T17:36:44.0603005-05:00 [DBG] Executing op Helo with key “{"i":"1aa0cdd8b3579acd/0000000000000002","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 3. (763fc9b0)
2020-05-19T17:36:44.0603005-05:00 [DBG] Executing op Helo with key “{"i":"1aa0cdd8b3579acd/0000000000000001","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 4. (763fc9b0)
2020-05-19T17:36:44.0890520-05:00 [DBG] Completed executing op Helo with key “{"i":"1aa0cdd8b3579acd/0000000000000001","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 4 (1b7c92d9)
2020-05-19T17:36:44.0890503-05:00 [DBG] Completed executing op Helo with key “{"i":"1aa0cdd8b3579acd/0000000000000002","a":"couchbase-net-sdk/3.0.1.0 (clr/.NET Core 3.1.3) (os/Microsoft Windows 6.3.9600)"}” and opaque 3 (1b7c92d9)
2020-05-19T17:36:44.1030624-05:00 [DBG] Executing op GetErrorMap with key “” and opaque 6. (763fc9b0)
2020-05-19T17:36:44.1030624-05:00 [DBG] Executing op GetErrorMap with key “” and opaque 8. (763fc9b0)
2020-05-19T17:36:44.1073707-05:00 [DBG] Completed executing op GetErrorMap with key “” and opaque 6 (1b7c92d9)
2020-05-19T17:36:44.1073709-05:00 [DBG] Completed executing op GetErrorMap with key “” and opaque 8 (1b7c92d9)
2020-05-19T17:36:44.2102985-05:00 [INF] v=BQ8I85YVsRz4tcnCjgm9wx1/oiE= (48b07e49)
2020-05-19T17:36:44.2102988-05:00 [INF] v=GkFYnr2p8AGqwyn1ifDzFvb4pcc= (a6d93c5d)
2020-05-19T17:36:44.2158922-05:00 [DBG] Starting connection pool monitor on “127.0.0.1:11210”, idle timeout 00:01:00, back pressure threshold 8 (41924b22)
2020-05-19T17:36:44.2161160-05:00 [DBG] Connection pool for “127.0.0.1:11210” initialized with 2 connections. (ee89feb4)
2020-05-19T17:36:44.2186095-05:00 [DBG] Executing op GetClusterConfig with key “” and opaque 14. (763fc9b0)
2020-05-19T17:36:44.2237607-05:00 [DBG] Server returned BucketNotConnected for op GetClusterConfig with key “” and opaque 14. (adc54a33)
2020-05-19T17:36:44.2292626-05:00 [DBG] Added “127.0.0.1:11210” (5363a1fe)
2020-05-19T17:36:44.2730314-05:00 [DBG] Executing op SelectBucket with key “mytestbucket” and opaque 15. (763fc9b0)
2020-05-19T17:36:44.2738675-05:00 [DBG] Completed executing op SelectBucket with key “mytestbucket” and opaque 15 (1b7c92d9)
2020-05-19T17:36:44.2745874-05:00 [DBG] Executing op SelectBucket with key “mytestbucket” and opaque 16. (763fc9b0)
2020-05-19T17:36:44.2748460-05:00 [DBG] Completed executing op SelectBucket with key “mytestbucket” and opaque 16 (1b7c92d9)
2020-05-19T17:36:44.2819101-05:00 [DBG] Executing op GetClusterConfig with key “” and opaque 18. (763fc9b0)
2020-05-19T17:36:44.2832144-05:00 [DBG] Completed executing op GetClusterConfig with key “” and opaque 18 (1b7c92d9)
2020-05-19T17:36:44.5215309-05:00 [DBG] ExistingEndpoints: [“127.0.0.1:11210”], revision 119. (27124e82)
2020-05-19T17:36:44.5223297-05:00 [DBG] RemovedEndpoints: , revision {revision.} (a3ca1807)
2020-05-19T17:36:44.5663217-05:00 [DBG] Stopping connection pool monitor on “127.0.0.1:11210” (eb2fb2ca)

This might be related, although you seemed to connect and run through server negotiation later.

  • Couchbase is running locally - same server as app?

  • Can you confirm that the Query service is running on the cluster you are connecting to?

-Jeff

That’s correct, I’m running couchbase on my dev box alongside the app with the connection string as “couchbase://127.0.0.1”, I’ve also tried “couchbase://localhost” with the same results, in both instances I can see this same log message

There was an error attempting to resolve hosts using DNS-SRV - “Non-Existent Domain” (9daf8ee2)

I can run queries through the UI with the Query Workbench without any issue and as far as I understand the query service would have to be running for that to work, correct?

In case it is relevant, I’m running the 6.0.1 version of Couchbase and not the latest.

@coreyponsv -

Yeah, should be working then. Perhaps its a bug with 6.0.1 and a local instance?

-Jeff

I installed the newest version of couchbase locally, it looks like this query is now working, although I have a little concern that it won’t work in our deployed environments as they are also on 6.0.1.

Thanks for your help @jmorris

i had same problem and eventually it was by mistake i passed 0 (zero) as the KVConnectTimeout.
annoying when an error is unrelated to the actual problem

I get this message when doing Cluster.ConnectAsync using an invalid user name or password. Obviously, the error message: Couchbase.ServiceNotAvailableException: Service n1ql not available. is EXTREMELY unhelpful in this context.

How are we supposed to detect when authentication fails?