Bucket with name myBucket does not exist

Hi, @ingenthr

We are using Couchbase Community Edition 6.5.1 deployed in amazon linux 2

@ingenthr or @jmorris any update from AWs about this issue?

Today, I moved from client 2.x to 3.x, since 2.x client with Couchbase 6.5 search service have bugs.
I got the same issue of Bucket name and what solved my problems was using correct configuration of 3.x client:
my config:
“ConnectionString”: “http://168.xxx.xxx.xxx”, => not port at all & instead of servers parameter ConnectionString
“Username”: “user”,
“Password”: “xxx”

2 Likes

Hi @Shlomo_Shs Still i am getting the same issue. FYI we deployed our couchbase server in EC2.

Is your server also deployed in AWS Ec2? If you don’t mind can you please share a code snippet for Couchbase connection by using .NET Client SDK.

Hi,
Forgot to mention that we upgraded to couchbase server 6.6 (not sure if it’s effecting…)
Our servers deployed in a private virtual machine.
We are using couchbase dependency injection this way:

services.AddCouchbase(Configuration.GetSection(“Couchbase”)); //configuration as i mentioned
services.AddCouchbaseBucket(“RbnsBucket”); //this use the new way of inject bucket name (using INamedBucketProvider interface) , new in couchbase dependency injection client

Hope it’s help

Hi, I haven’t found AddCouchbase. Can you please share me a reference document to the couchbase dependency injection client?

Thanks for your help.

Hi,

This part of using the Couchbase dependency injection extension. Look at github:
https://github.com/couchbase/couchbase-net-client

Yow will have to add this package in order to use it.

1 Like

Awesome and thank you.

@itssrinadh

Also: https://docs.couchbase.com/dotnet-sdk/3.0/howtos/managing-connections.html#connection-di

1 Like

@btburnett3 Thank you.

I am facing the same issue. Did you guys resolve this?

The most likely cause of the bucket name error, assuming the bucket exists, is in your connection string. I recommend using the modern connection string format “couchbase://server1,server2,server3” with no port numbers, if you aren’t already. I’ve definitely seen reports of problems from people converting and keeping the http:// format with the port number that used to be used in SDK 2.x.

@btburnett3 we tried with couchbase://ipaddress without port number but still same issue.
Now we are trying to use the following

https://docs.couchbase.com/dotnet-sdk/3.0/howtos/managing-connections.html#connection-di

I think the most likely cause is related to the network configuration, name/ip resolution, or some other environmental issue within Kubernetes. I recommend running the SDK Doctor in Kubernetes to ensure that you have all of the connectivity right.

For Kubernetes, you can run

kubectl run sdktest --rm --restart=Never -i --image couchbase/sdk-doctor -- diagnose couchbase://node/bucket -u username -p password

Add a namespace to the command line if you’re not working in the default namespace.

2 Likes

@btburnett3 We installed our Couchbase server on EC2 Instance and we are using Kubernetes. Please let us know how to run SDK Doctor in this case and how can find the network configuration, name/ip resolution, or some other environmental issues in AWS Ec2 instance.

Thanks, @btburnett3. The issue resolved for me, as the couchbase cluster exposes two service URL’s one is bound to port 8091 and the other to 11210. The service that points to 8091 was causing the issue. The other one works as expected

1 Like

@itssrinadh

For use outside of Docker/Kubernetes, there are some instructions on the GitHub repository. https://github.com/couchbaselabs/sdk-doctor

It’s pretty similar, but you’ll need to download the binaries.

Hi!
Same issue here,using .NET core 3.1.
Dependencies…
CouchbaseNetClient 3.0.5
Couchbase.Extensions.DependencyInjection 3.0.5
And code as follow…
namespace couchbasetestproject
{
public interface IMyBucketProvider : INamedBucketProvider
{
}
}
//in startup.cs
public void ConfigureServices(IServiceCollection services)
{
//CouchBase configuration using Dependency Injection
services.AddCouchbase(Configuration.GetSection(“Couchbase”));
services.AddCouchbaseBucket(“bucketname”);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime applicationLifetime)
{
applicationLifetime.ApplicationStopped.Register(() =>
{
//Cleaning up using using Dependency Injection
app.ApplicationServices.GetRequiredService().Close();
});
}
//in appsettings.json
added code i.e.,
“Couchbase”: {
“Servers”: [
“couchbase://ipaddress”
],
“Username”: “xyz”,
“Password”: “xyz”,
“UseSsl”: false
}
//contoller
public class CouchBaseTestStatusController : Controller
{
private readonly IMyBucketProvider _bucket;
public CouchBaseTestStatusController(IMyBucketProvider bucketProvider)
{
_bucket = bucketProvider;
}
[HttpPost]
public async Task GetStatusDocsFromTestAPI([FromBody] List IDs)
{
try
{
var bucket = await _bucket.GetBucketAsync();
var queryResult = await bucket.Cluster.QueryAsync
(
“SELECT * FROM BucketName WHERE type=xyz AND companyID=$1”,
options => options.Parameter(IDs)
);
return Ok(new { testResponse = queryResult });
}
catch (Exception ex)
{
return Conflict(new
{
testError = ex.Message + ex.InnerException?.Message
});
}
}
}
getting exception i.e.,
System.TypeLoadException: Access is denied: ‘Couchbase.Extensions.DependencyInjection.Internal.NamedBucketProvider’.
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
at Couchbase.Extensions.DependencyInjection.Internal.NamedBucketProxyGenerator.CreateProxyType(Type interfaceType)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Couchbase.Extensions.DependencyInjection.Internal.NamedBucketProxyGenerator.GetProxy[T](IBucketProvider bucketProvider, String bucketName)
at Couchbase.Extensions.DependencyInjection.ServiceCollectionExtensions.<>c__DisplayClass2_01.<AddCouchbaseBucket>b__0(IServiceProvider serviceProvider) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method(Closure , IServiceProvider , Object )
at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
— End of stack trace from previous location where exception was thrown —
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

HEADERS

Accept: /
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 36
Content-Type: application/json
Host: localhost:57758
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Postman-Token: d587623c-000b-bfd0-cdc2-5f819b0e9f35
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Sec-Fetch-Site: none
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty

Am I doing something wrong?

It’s possible that 3.0.5 may have been packaged with incorrect strong name keys or some similar issue. You might try downgrading to 3.0.4.811 and see if that works correctly?

@btburnett3
Hi,
I downgraded dependency injection to 3.0.4.811…so i’m not getting that exception.Thank you for that.
But at “var bucket = await _bucket.GetBucketAsync();” i got exception as follow,
Message:
options must have a connection string. (Parameter ‘options’)
stacktrace:
at Couchbase.Cluster.d__25.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at Couchbase.Extensions.DependencyInjection.Internal.ClusterProvider.<GetClusterAsync>d__5.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable1.ConfiguredValueTaskAwaiter.GetResult() at Couchbase.Extensions.DependencyInjection.Internal.BucketProvider.<<GetBucketAsync>b__4_0>d.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
at couchbasetestproject.Controllers.CouchBaseTestStatusController.d__2.MoveNext() in C:\Users\OSIS\source\repos\couchbasetestproject\couchbasetestproject\Controllers\CouchBaseTestStatusController.cs:line 29