a year 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 ::
0 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,
}),
}),
a year ago
sleep is not needed with the v2 runtime, you can remove that
a year ago
are you getting the error from build or runtime logs?
a year ago
i assume cache-manager-redis-store uses ioredis under the hood, if so, please read -
a year 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.
a year ago
redis does not have a private domain of redis-awln.railway.internal
in the linked project
a year ago
please only ever use reference variables -
that way you can avoid these kinds of mistakes
a year ago
are we looking at different projects?
a year ago
this is a screenshot from your linked project
a year ago
okay i wasnt told this was pr-47
a year ago
fair assumption
a year ago
try settings family: 0,
in the same config that you set the username
a year 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,
}),
}),
a year ago
is this using ioredis under the hood?
a year 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
a year 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
a year ago
of course
a year ago
great!