This is a minimal reproduction case for the Redis cache issue that occurs when upgrading from an earlier version of TypeORM to 0.3.26.
When using TypeORM 0.3.26 with Redis caching, queries with cache enabled fail with an error in RedisQueryResultCache.getFromCache. This issue does not occur in earlier versions of TypeORM.
cd typeorm-cache-repro
docker-compose up -dThis will start:
- PostgreSQL on port 5433
- Redis on port 6380
npm installnpm run start:devThe application will be available at http://localhost:3000
- Call the get endpoint (which uses cache):
curl http://localhost:3000/posts
- Check the console for any cache errors
The queries should execute successfully and use Redis for caching without errors.
Queries with cache enabled throw errors related to RedisQueryResultCache.getFromCache.
src/posts.repository.ts- Contains the problematic queries with cache enabledsrc/app.module.ts- TypeORM configuration with Redis cachesrc/entities/index.ts- Entity definitions matching your schema
To test with a different version of TypeORM:
# Install a specific version
npm install [email protected]
# Restart the application
npm run start:dev