Skip to content

Default cacheId behaviour breaks with serverless elasticache #11562

Open
@AndKiel

Description

@AndKiel

Issue description

Because of the key name length limit in serverless elasticache, keys generated by typeorm may exceed maximum size.

Expected Behavior

TypeORM should generate shorter cache keys, for example, by creating a digest from the SQL query and parameters.

Relevant code:

Actual Behavior

ReplyError: ERR Request contains a key that is longer than the max key size of 4096 bytes

Steps to reproduce

Connect TypeORM to serverless elasticache using ioredis/cluster cache type:

      {
        type: "ioredis/cluster",
        options: {
          startupNodes: [{ host: "...", port: "..." }],
          options: {
            dnsLookup: (address: string, callback: Function) => callback(null, address),
            redisOptions: { tls: {} },
          },
        },
      }

Then run a very long query with multiple joins and parameters that would cause the cache key to exceed the limit.

My Environment

No relevant dependencies to list.

Additional Context

Official documentation mentioning the key name length limit: https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/RedisConfiguration.html#RedisConfiguration.Serverless

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions