Skip to content

Cluster client throws "TypeError: Cannot read properties of undefined (reading 'redis')" on AWS Elasticache Serverless ValkeyΒ #31

@ekscentrysytet

Description

@ekscentrysytet

Hi community! Thanks for the fork and your work maintaining this lib!

We've deployed our app that connects to AWS Elasticache Serverless Valkey cluster as:

const valkey = new Valkey.Cluster(
    [
      {
        host: "...",
        port: "...",
      },
    ],
    {
      clusterRetryStrategy(times) {
        if (times > 60) {
          return null
        }

        return 1000
    },
      dnsLookup: (address, callback) => callback(null, address),
      redisOptions: {
        password: "..."
        username: "...",
        maxRetriesPerRequest: 2,
        commandTimeout: 500,
        tls: {
          rejectUnauthorized: false,
        },
      },
    },
  )

And everything worked fine, untli we started to see following errors in logs:

Cannot read properties of undefined (reading 'redis')","stack":"TypeError: Cannot read properties of undefined (reading 'redis')
 at ConnectionPool.getSampleInstance (/app/node_modules/iovalkey/built/cluster/ConnectionPool.js:31:50)
 at tryConnection (/app/node_modules/iovalkey/built/cluster/index.js:455:56)
 at EventEmitter.sendCommand (/app/node_modules/iovalkey/built/cluster/index.js:397:9)
 at EventEmitter.get (/app/node_modules/iovalkey/built/utils/Commander.js:90:25)
 ....

By discovering repo, I can see it's related to changes made in this PR: #5.

I guess the issue also can be related to AWS Elasticache Serverless runtime.
Did anyone face such issue ?

@martinslota tagging for visibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions