-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Describe the bug
I have a .net core3.1 application using steeltoe 3.1.1 packages. I do have below code in Startup.cs
services.AddRedisConnectionMultiplexer(configuration);
I do have below packages in .csproj
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.21" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="Steeltoe.Connector.ConnectorCore" Version="3.1.1" />
<PackageReference Include="Steeltoe.Extensions.Logging.DynamicSerilogCore" Version="3.1.1" />
<PackageReference Include="Steeltoe.Management.CloudFoundryCore" Version="3.1.1" />
<PackageReference Include="Steeltoe.Extensions.Configuration.CloudFoundryCore" Version="3.1.1" />
Whenever I try to connect to Redis via below lines
public class RedisCache
{
private readonly IConnectionMultiplexer _conn;
public RedisCache(IConnectionMultiplexer conn)
{
this._conn = conn;
}
public bool PutItem<T>(string key, T value, TimeSpan expiry, bool overwrite = true)
{
bool isAdded = false;
IDatabase database = _conn.GetDatabase();
if (!database.KeyExists(key) || overwrite)
{
var jsonString = JsonHelper.Serialize(value);
database.StringSet(key, jsonString, expiry);
isAdded = true;
}
return isAdded;
}
}
Below exception is getting generated in vmw apps manager console
2021-12-01T19:03:17.263+05:30 [APP/PROC/WEB/0] [OUT] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
2021-12-01T19:03:17.263+05:30 [APP/PROC/WEB/0] [OUT] ---> StackExchange.Redis.RedisConnectionException: It was not possible to connect to the redis server(s). There was an authentication failure; check that passwords (or client certificates) are configured correctly.
2021-12-01T19:03:17.263+05:30 [APP/PROC/WEB/0] [OUT] at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(ConfigurationOptions configuration, TextWriter log) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1195
2021-12-01T19:03:17.263+05:30 [APP/PROC/WEB/0] [OUT] at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log) in /_/src/StackExchange.Redis/ConnectionMultiplexer.cs:line 1061
2021-12-01T19:03:17.263+05:30 [APP/PROC/WEB/0] [OUT] --- End of inner exception stack trace ---
Steeltoe documentation says that ssl is false by default https://docs.steeltoe.io/api/v3/connectors/redis.html, we are not sure why this exception is thrown then. This is noted after the platform upgrade https://docs.pivotal.io/redis/2-4/release.html. After this upgrade, the env. variable of the application has TLS ports too like below.
"my.redis": [
{
"label": "my.redis",
"provider": null,
"plan": "cache-medium",
"name": "MyRedis",
"tags": [
"redis",
"pivotal",
"on-demand"
],
"instance_guid": "*****",
"instance_name": "MyRedis",
"binding_guid": ****",
"binding_name": null,
"credentials": {
"host": "q-s0.redis-instance.service-network.service-instance-eb72c7c5--4866-a44f-.bosh",
"password": "*****",
"port": 6379,
"tls_port": 16379,
"tls_versions": [
"tlsv1.2",
"tlsv1.3"
]
},
Any idea how to solve this?
Environment (please complete the following information):
- Steeltoe Version : 3.1.1
- Platform: VMW Tanzu Application Service
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context or links
Add any other context about the problem here.