R
Railway11mo ago
Andycko

Unable to access Browserless service through private network

Hi, I have a Node.js API running in a service and a Browserless instance in another service. Both are in the same project and both are deployed from Docker images. I can't seem to get the private networking to work. Every time my API tries to connect to Browserless through the internal link, it errors out Error: getaddrinfo ENOTFOUND browserless.railway.internal. When using the public address for Browserless, it works fine. Any ideas what could be the issue? Thanks Project ID: 1cd9e13b-7e15-421e-9db9-c908c4e42e7e
20 Replies
Percy
Percy11mo ago
Project ID: 1cd9e13b-7e15-421e-9db9-c908c4e42e7e
Percy
Percy11mo ago
Project ID: 1cd9e13b-7e15-421e-9db9-c908c4e42e7e
Fragly
Fragly11mo ago
Private Networking takes 100ms to initialize, you'd need to add a bit of initial delay before trying to connect to the private network 3 seconds is a good amount
Andycko
AndyckoOP11mo ago
I believe that puppeteer (the library I'm using to connect to Browserless) has a 30second timeout by default, so that should be plenty. Can you think about anything else that could be the issue here?
Medim
Medim11mo ago
Timeout != Delay Could u try adding the sleep 3 && ~your start command~?
Andycko
AndyckoOP11mo ago
Oh, so do you mean delay after the browserless service starts up? Sorry I meant that on every connection it needs the extra 100ms. I will try your solution, but I don't think this should be the issue then, because the service has been up for nearly an hour now. (Sorry if I'm not understanding something here)
Medim
Medim11mo ago
Try it, we'll see. Its a common issue with railway's private networking delay before the browserless service starts
Brody
Brody11mo ago
another question that might be worth asking, are you deploying your node api with nixpacks?
Andycko
AndyckoOP11mo ago
No, I'm not. I am using just my own Dockerfile to build the image. Tbh this is the first time I'm hearing about nixpacks.
Brody
Brody11mo ago
does the dockerfile use an alpine image?
Andycko
AndyckoOP11mo ago
yes
Andycko
AndyckoOP11mo ago
🤦‍♂️🤦‍♂️ I actually read it, I just didn't think about it as I was so focused on the issue being somewhere in the Browserless deployment ... Thanks, I'll try adding the env var! Interestingly enough, adding the env variable to Railway, crashed my startup command. I am using https://infisical.com/ to manage my env variables and that injects variables with the startup command like so infisical run -- node server.js. The error being "dial tcp: lookup app.infisical.com on [fd12::10]:53: dial udp [fd12::10]:53: connect: cannot assign requested address"
Brody
Brody11mo ago
you still need the delay like medium said
Andycko
AndyckoOP11mo ago
So I added the sleep, which fixed the issue with the startup of the node app, however the error with the connection still remains. One thing though, I added the sleep only to the node container as I'm not too sure what startup command to use with the browserless container.
Brody
Brody11mo ago
the browserless container does not need a started delay what error are you seeing now
Andycko
AndyckoOP11mo ago
Basically the same error as in the beginning Error: connect ECONNREFUSED fd12:8e79:a9ab::3f:26ae:72f2:443 but what's changed is that the domain name has been switched for IPv6 addr
Brody
Brody11mo ago
okay perfect your app can now do a DNS lookup, what I think is happening is that the browserless service is not listening on an IPv6 address, it needs to because the private network is IPv6 only, I'll look into this, but no promises on a resolution
Andycko
AndyckoOP11mo ago
Thanks for the help with this, I have been using the public URL so far but I recognise it’s a very bad and potentially expensive idea since basically anyone could use my browserless instance 😳 Am I right in thinking that there is no dedicated firewall/NAT gateway setup on Raliway?
Brody
Brody11mo ago
you are correct, instead you want to remove the public domain and only use the internal private domain
Want results from more Discord servers?
Add your server