ENOTFOUND redis.railway.internal

First time using railway. I'm on team plan which says it supports private networking. I have a simple nodejs application and a redis service. I've shared the redis variables as per the guide. project id is: 32ae1873-09b1-4c70-ae4b-ca9b93e854da is something broken or am i missing something? import Redis from "ioredis"; const redis = new Redis(process.env.REDIS_URL); REDIS_URL is shared from the service as ${{Redis.REDIS_PRIVATE_URL}}
Solution:
ioredis constructor expects family to be 0 no '0'
P
Percy45d ago
Project ID: 32ae1873-09b1-4c70-ae4b-ca9b93e854da
B
Brody45d ago
J
jeff45d ago
i've updated to const redis = new Redis(process.env.REDIS_URL + "?family=0"); i still have the same error. does it matter that i started this project as hobby, where im told private networking doesn't work. and then imported things to team?
B
Brody45d ago
nope, doesnt matter. have you added a 3 second sleep to your start script?
J
jeff45d ago
lol no.
B
Brody45d ago
please try that
J
jeff45d ago
ok i got dragged away for a meeting. this is still no go. even with the 3second delay.
B
Brody45d ago
nixpacks or dockerfile?
J
jeff45d ago
i just pushing up a project. looking at the build logs, its using nixpack, which is ubuntu based. so i have a working nodejs application (locally). im just pushing it up to test railway. i usually use heroku.
B
Brody45d ago
to be clear, you get ENOTFOUND redis.railway.internal when deployed to railway right?
J
jeff45d ago
yeah
B
Brody45d ago
can you show me how you have implemented the 3 second sleep?
J
jeff45d ago
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); await delay(3000); just block. do this at the top before any dns lookups would happen
B
Brody45d ago
please add the sleep to your start script instead
J
jeff45d ago
oh so make my start script... sleep 3000; node index.js 3 maybe
B
Brody45d ago
that would sleep for 50 minutes, sleep 3 is what you want
J
jeff45d ago
ok its actually different now. /app/node_modules/ioredis/built/Redis.js:332 command.reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
B
Brody45d ago
what version of ioredis are you using?
J
jeff45d ago
so do i need username and password for internal connection? i currently am...
B
Brody45d ago
yes of course
J
jeff45d ago
"ioredis": "^5.3.2",
B
Brody45d ago
thats latest, so thats good what is REDIS_URL set to?
J
jeff45d ago
redis://default:464lPFFidM4ll2K6olIBNHAgJgiG21ap@redis.railway.internal:6379
B
Brody45d ago
it should be set to ${{Redis.REDIS_PRIVATE_URL}}
J
jeff45d ago
const redis = new Redis(process.env.REDIS_URL + "?family=0"); yes it is... ${{Redis.REDIS_PRIVATE_URL}} i expanded it
B
Brody45d ago
okay lets see your client code please
J
jeff45d ago
sure... here is the stacktrace.
B
Brody45d ago
please send the redis client code
J
jeff45d ago
well its actually not the ioredis this time... it might be a similar issue with bull. not sure if your familiar with this.
J
jeff45d ago
im just reading the docs here. it says everything in the second param is passed right to the iosredis constructor. https://github.com/OptimalBits/bull/blob/develop/REFERENCE.md#queue
GitHub
bull/REFERENCE.md at develop · OptimalBits/bull
Premium Queue package for handling distributed jobs and messages in NodeJS. - OptimalBits/bull
J
jeff45d ago
so im also instantiating a queue. const fetchHTMLQueue = new Queue( "fetchHTML", process.env.REDIS_URL + "?family=0" ); and now its breaking on .getJobs(). await redis.set("block:https://www.centrecom.com/test/product", "404"); let alreadyQueued = (await fetchHTMLQueue.getJobs(["active", "waiting"])).map( (job) => job.data.url );
B
Brody45d ago
okay I'll try to get a minimal reproducible example working with that library
J
jeff45d ago
does it break for you also?
B
Brody45d ago
I haven't started, currently eating dinner
J
jeff45d ago
what country? im from Aus
B
Brody45d ago
Canada
J
jeff45d ago
Nice! looks like there is a bug in bull, i think i got it sorted
B
Brody45d ago
what was it?
J
jeff45d ago
so when you initilise a queue with bull, and pass in a redis connection string. it uses a url parser to pull it apart and then passes this to ioredis constructor
Solution
J
jeff45d ago
ioredis constructor expects family to be 0 no '0'
J
jeff45d ago
TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.family' must be one of: 0, 4, 6. Received '0'
B
Brody45d ago
ah it wants it to be a number
J
jeff45d ago
anyhow... still not out of the woods. more issues. with redis. but ill have more of a play till i bother you again. but is definilty not the "point and click" i was expecting
B
Brody45d ago
yeah very odd that ioredis defaults to ipv4
J
jeff45d ago
ok so i have all this working now... thanks fro your help. do i need to stay on the team for private networking to work? or will my nodejs still be able to connect to redis on hobby?
B
Brody45d ago
private networking is not limited to pro, but depending on your workload, you may need to stay on pro anyway
J
jeff45d ago
when i do railway up, at what point can i kill that and it will still deploy?
B
Brody45d ago
after its done uploading, you may be interested in the --detach flag
~> railway up --help
Upload and deploy project from the current directory

Usage: railway up [OPTIONS] [PATH]

Arguments:
[PATH]

Options:
-d, --detach Don't attach to the log stream
-s, --service <SERVICE> Service to deploy to (defaults to linked service)
-e, --environment <ENVIRONMENT> Environment to deploy to (defaults to linked environment)
--json Output in JSON format
-h, --help Print help
-V, --version Print version
~> railway up --help
Upload and deploy project from the current directory

Usage: railway up [OPTIONS] [PATH]

Arguments:
[PATH]

Options:
-d, --detach Don't attach to the log stream
-s, --service <SERVICE> Service to deploy to (defaults to linked service)
-e, --environment <ENVIRONMENT> Environment to deploy to (defaults to linked environment)
--json Output in JSON format
-h, --help Print help
-V, --version Print version
J
jeff45d ago
yeah ok ill do -d is there any ETA's for sydney/melbourne regions?
B
Brody45d ago
nope, but you upvote this forum post and with enough upvotes it will show the team that there is need for that region https://help.railway.app/feature-request/australia-region-4d98acbd
J
jeff45d ago
done i'd say that needs a bit more circulation
B
Brody45d ago
you are welcome to circulate it in a non intrusive way
Want results from more Discord servers?
Add your server
More Posts
Error: libuuid.so.1: cannot open shared object file: No such file or directoryGetting this error with puppeteer on Railway. ``` node:internal/modules/cjs/loader:1239 return pro"Error: connection already closed."I keep getting this error message when I attempt to update a user in my PostgreSQL database. I do noUnable to update Variables in App. (First Update after Migration)Hey Guys, my App tries to connect to the old containers of my postgres and redis. I checked the variImage Storagehello everyone, can I use Postgresql to store the images which my users upload in django-project?Setup Cloudflare Proxy1. Clicked "custom domain". 2. Railway pops up a CNAME for me to add to Cloudflare. 3. Add CNAME recDirectus: impossible to update or to run the old versionProject ID : 9be34f5b-fa35-49c1-83c5-f0fbd245db9b Template : https://github.com/kadumedim/directus-sCSV files in storage/app/data/csv not accessible?Hello, I've setup a laravel api on railway. I have a seeder that tries to load csv files from the I have not touched my project in several weeks but at midnight railway reverted to a very old versioI'm very confused it looks like my project was deployed last night, although I have not touched it iI can't add DNS from GoDaddy to RailwayThey recommend me to change the server name...Unable to connect database after payentHello, i just pay for the month, now i'm unable to connect to the database. please help1,2GB RAM usage in React APPDo you know if it's normal this size of ram in a frontend created with react and typescript?Shopify proxy and HTTP/1.0Hello, I need help from members using Railway to host a Shopify app. I ran into this problem where Is it possible to change the default config of a Mysql Container?By default the container uses up a minimum of 500mb of ram, I found a stack overflow post on how to Cannot link, login nor logout with cli>railway logout 🚨 Response not successful status=404 >railway login 🚨 Response not successful staLost 2FA code for my accountI have lost my 2FA authenticator codes and I would like to reset my accountHow does it work the HD allocationI need 360gb to use how much does it cost?how to restore postgres db from dumb?i was given my db archives because my db was deleted due to migration. I am trying to restore the dbActivate SSL on my custom domainHello, I bought the domain apocolinks.com at DreamHost.com, this domain already has an active SSL ceBest way to secure postgres?What would be the best way to secure my postgres instance from outside connections? I would just turdeployments "Crashed"Hello, good afternoon, my problem is: deployments "Crashed" and the information in deploy logs Messa