2 years ago
Unable to connect my nestjs server to redis using the private network url
added 5s sleep before start and build commands
both run in v2 runtime
nestjs server runs on ipv6 using ::
47 Replies
CacheModule.registerAsync({
isGlobal: true,
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
store: redisStore,
url: configService.get('REDIS_URL'),
password: configService.get('REDIS_PASSWORD'),
username: configService.get('REDIS_USERNAME'),
ttl: 5,
}),
}),2 years ago
sleep is not needed with the v2 runtime, you can remove that
2 years ago
are you getting the error from build or runtime logs?
2 years ago
i assume cache-manager-redis-store uses ioredis under the hood, if so, please read -
2 years ago
append ?family=0 yes
Error: getaddrinfo ENOTFOUND redis-awln.railway.internal at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26) ELIFECYCLE Command failed with exit code 1.
2 years ago
redis does not have a private domain of redis-awln.railway.internal in the linked project

2 years ago
please only ever use reference variables -
that way you can avoid these kinds of mistakes
2 years ago
are we looking at different projects?
2 years ago
this is a screenshot from your linked project
2 years ago
okay i wasnt told this was pr-47
2 years ago
fair assumption
2 years ago
try settings family: 0, in the same config that you set the username
2 years ago
lets see the updated code?
CacheModule.registerAsync({
isGlobal: true,
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
family: 0,
store: redisStore,
url: configService.get('REDIS_URL'),
password: configService.get('REDIS_PASSWORD'),
username: configService.get('REDIS_USERNAME'),
ttl: 5,
}),
}),2 years ago
is this using ioredis under the hood?
2 years ago
i saw your other messages, it said ioredis
"cache-manager": "^4",
"cache-manager-redis-store": "2.0.0",only these are relevant libraries for using redis
the cache manager redis store package is outdated, but i remember vaguely that we have it that since certain feature with nestjs was not working but let me try updating it to experiment
2 years ago
the version of redis that cache-manager-redis-store v2.0.0 uses is from 2021, likely didnt have support for ipv6 back then, so please upgrade cache-manager-redis-store to the latest version
@Brody did not see any errors and server didnt crash
Can i keep this thread up till I confirm by testing a few stuff around the server
2 years ago
of course
2 years ago
great!

