a year ago
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);
REDISURL is shared from the service as ${{Redis.REDISPRIVATE_URL}}
0 Replies
a year ago
please have a look at this docs section for ioredis
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?
a year ago
nope, doesnt matter.
have you added a 3 second sleep to your start script?
a year ago
please try that
i got dragged away for a meeting. this is still no go. even with the 3second delay.
a year ago
nixpacks or dockerfile?
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.
a year ago
to be clear, you get ENOTFOUND redis.railway.internal
when deployed to railway right?
a year ago
can you show me how you have implemented the 3 second sleep?
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
await delay(3000);
a year ago
please add the sleep to your start script instead
a year ago
that would sleep for 50 minutes, sleep 3 is what you want
ok its actually different now.
/app/nodemodules/ioredis/built/Redis.js:332 command.reject(new Error(utils1.CONNECTIONCLOSEDERROR_MSG));
a year ago
what version of ioredis are you using?
a year ago
yes of course
a year ago
thats latest, so thats good
a year ago
what is REDIS_URL
set to?
redis://default:464lPFFidM4ll2K6olIBNHAgJgiG21ap@redis.railway.internal:6379
a year ago
it should be set to ${{Redis.REDIS_PRIVATE_URL}}
a year ago
okay lets see your client code please
a year ago
please send the redis client code
well its actually not the ioredis this time… it might be a similar issue with bull. not sure if your familiar with this.
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
so im also instantiating a queue.
const fetchHTMLQueue = new Queue(
"fetchHTML",
process.env.REDIS_URL + "?family=0"
);
`await redis.set("block:https://www.centrecom.com/test/product", "404");
let alreadyQueued = (await fetchHTMLQueue.getJobs(["active", "waiting"])).map(
(job) => job.data.url
);`
a year ago
okay I'll try to get a minimal reproducible example working with that library
a year ago
I haven't started, currently eating dinner
a year ago
Canada
a year ago
what was it?
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
TypeError [ERRINVALIDARG_VALUE]: The property 'options.family' must be one of: 0, 4, 6. Received '0'
a year ago
ah it wants it to be a number
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
a year ago
yeah very odd that ioredis defaults to ipv4
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?
a year ago
private networking is not limited to pro, but depending on your workload, you may need to stay on pro anyway
when i do railway up
, at what point can i kill that and it will still deploy?
a year 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 to deploy to (defaults to linked service)
-e, --environment Environment to deploy to (defaults to linked environment)
--json Output in JSON format
-h, --help Print help
-V, --version Print version
a year ago
nope, but you upvote this forum post and with enough upvotes it will show the team that there is need for that region
a year ago
you are welcome to circulate it in a non intrusive way