RedisCommandTimeOutException while making connecting micronaut lambda with elastic-cache

465 Views Asked by At

I am trying to create a lambda using Micronaut-2 connecting to elastic-cache.

I have used redis-lettuce dependency in the project with the following configuration and encryption on the transaction is enabled in the elastic-cache config.

redis:
    uri: redis://{aws master node endpoint}
    password: {password}
    tls: true
    ssl: true
    io-thread-pool-size: 5
    computation-thread-pool-size: 4

I am getting below exception:

command timed out after 1 minute(s): io.lettuce.core.rediscommandtimeoutexception
    io.lettuce.core.rediscommandtimeoutexception: command timed out after 1 minute(s) at
    io.lettuce.core.exceptionfactory.createtimeoutexception(exceptionfactory.java:51) at
    io.lettuce.core.lettucefutures.awaitorcancel(lettucefutures.java:119) at
    io.lettuce.core.futuresyncinvocationhandler.handleinvocation(futuresyncinvocationhandler.java:75)
    at io.lettuce.core.internal.abstractinvocationhandler.invoke(abstractinvocationhandler.java:79)
    com.sun.proxy.$proxy22.set(unknown source) at
    hello.world.function.httpbookredishandler.execute(httpbookredishandler.java:29) at 
    hello.world.function.httpbookredishandler.execute(httpbookredishandler.java:16) at 
    io.micronaut.function.aws.micronautrequesthandler.handlerequest(micronautrequesthandler.java:73)
    

I have tried with spring cloud function with same network (literally on the same lambda) with the same elastic cache setup, it is working fine. Any direction that can help me to debug this issue, please.

1

There are 1 best solutions below

0
On

This might be late. First thing to mention here is, an elastic-cache can only be accessed within a VPC. If you want to access it from the internet, it needs to have NAT GW enabled.