Nestjs <> Redis Unable to connect to redis using private network url
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 ::
Solution:Jump to solution
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
30 Replies
Project ID:
9820d186-43b6-43fb-bdaf-7203f784ca8a
9820d186-43b6-43fb-bdaf-7203f784ca8a/
sleep is not needed with the v2 runtime, you can remove that
are you getting the error from build or runtime logs?
runtime
i assume cache-manager-redis-store uses ioredis under the hood, if so, please read - https://docs.railway.app/guides/private-networking#known-configuration-requirements-for-ipv6
just to be sure, i just concat the private url with familiy=0?
append
?family=0
yeswill try and update here
redis://[username]:[password]@redis-awln.railway.internal:6379?family=0
redis does not have a private domain of
redis-awln.railway.internal
in the linked projectplease only ever use reference variables - https://docs.railway.app/guides/variables#referencing-another-services-variable
that way you can avoid these kinds of mistakes
oh i see, so this url is invalid?
had referenced it from here
are we looking at different projects?
this is a screenshot from your linked project
Yeah
copied id from browser
under pr-47
okay i wasnt told this was pr-47
sorry, my bad
thought the project id linked to pr
fair assumption
try settings
family: 0,
in the same config that you set the usernamejust pushed, building now
lets see the updated code?
is this using ioredis under the hood?
no its not
"redisStore" is from this
i saw your other messages, it said ioredis
unused library
replaced by this
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
Solution
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
will try and let you know
@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
of course
All seems good brod-a
great!