StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.84k stars 1.5k forks source link

Error Connecting to Elasticache Redis Serverless - How to use TextWriter for Details #2710

Open JRRan64 opened 2 months ago

JRRan64 commented 2 months ago

Id like to use an Elasticache Redis Serverless instance from a Lambda for "aggregating" data as it is ingested (write-thru cache).

StringWriter sw = new StringWriter(); ConfigurationOptions redCfgOptions = new ConfigurationOptions { EndPoints = { { envRedisEndPoint, envRedisPort } }, Ssl = true, ConnectRetry = 3 }

ConnectionMutliplexer redis = ConnectionMultiplexer.Connect(redCfgOption, sw); context.Logger.LogInformation("Connected !")

Elasticache Redis is configured and a .Net Lambda is deployed with a StringWriter when trying to connect. I never get i get the following when it tries

2024-05-03T16:36:45.046Z 9349f934-4fe6-5d45-90dd-a79b5b290b8e fail It was not possible to connect to the redis server(s). Error connecting right now. To allow this multiplexer to continue retrying until it's able to connect, use abortConnect=false in your connection string or AbortOnConnectFail=false; in your code.

So I will try AbortOnConnectFail=false but what I really want first is what am I doing wrong with StringWriter (impl of TextWriter abstract)

JRRan64 commented 2 months ago

Let me know if there are useful details I can add but my main concern is that I am not using TextWriter (StringWriter) correctly. I was hoping that would tell me more about what I am doing wrong. So far, it hasn't changed anything.

NickCraver commented 2 months ago

The StringWriter you passed into connect, you'll want to dump it for a full connection log :)