R
Railway8mo 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
Percy8mo ago
Project ID: 1cd9e13b-7e15-421e-9db9-c908c4e42e7e
Percy
Percy8mo ago
Project ID: 1cd9e13b-7e15-421e-9db9-c908c4e42e7e
Fragly
Fragly8mo 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
Andycko8mo 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
Medim8mo ago
Timeout != Delay Could u try adding the sleep 3 && ~your start command~?
Andycko
Andycko8mo 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
Medim8mo ago
Try it, we'll see. Its a common issue with railway's private networking delay before the browserless service starts
Brody
Brody8mo ago
another question that might be worth asking, are you deploying your node api with nixpacks?
Andycko
Andycko8mo 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
Brody8mo ago
does the dockerfile use an alpine image?
Andycko
Andycko8mo ago
yes
Andycko
Andycko8mo 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
Brody8mo ago
you still need the delay like medium said
Andycko
Andycko8mo 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.
Want results from more Discord servers?
Add your server