Browserless only listening to 127.0.0.1?
stauersbol
PROOP

2 years ago

Hello,

I'm trying to use browserless for my playwright testing…
But it never connects, I tried adding proxy environment but that didn't change anything…

What can I do?

Project id: 8692a59f-3cb6-4863-a67e-c9864cb63401

196 Replies

stauersbol
PROOP

2 years ago

This is what I did to try and make it work, but I just hit a wall, please note these ENV are per browserless's documentation


stauersbol
PROOP

2 years ago

I took a look on the /sessions page to see what endpoint it was using and it uses:


stauersbol
PROOP

2 years ago

Plus I am getting this also


stauersbol
PROOP

2 years ago

I'm gonna try adding the env vars to the project specifically instead inside of the Dockerfile


brody
EMPLOYEE

2 years ago

you would need to get browserless to listen on :: or [::] aka ipv6

then you'd want to use it's private domain to connect to it from other services while on railway


stauersbol
PROOP

2 years ago

Would I need to specific that as a HOST env?


brody
EMPLOYEE

2 years ago

unfortunately I am uncertain on how you would configure what host browserless runs on


brody
EMPLOYEE

2 years ago

for that, you would need to reference their documentation


stauersbol
PROOP

2 years ago

Alright


stauersbol
PROOP

2 years ago

Seems like it is just HOST as an environment variable


brody
EMPLOYEE

2 years ago

I assume you are using the browserless template?


stauersbol
PROOP

2 years ago

Uh yes


stauersbol
PROOP

2 years ago

Well I had to redeploy, but yes


brody
EMPLOYEE

2 years ago

that template is very old and thus made long before railway had private networking


brody
EMPLOYEE

2 years ago

you are not the first to have issues using it


stauersbol
PROOP

2 years ago

Yes, but it uses the latest docker image


brody
EMPLOYEE

2 years ago

yes, but it's missing the correct configurations to use it


brody
EMPLOYEE

2 years ago

in fact it's so old, it deploys from a Dockerfile when it should be just a docker image without a github repository


stauersbol
PROOP

2 years ago

[ghcr.io/browserless/base:latest](ghcr.io/browserless/base:latest) something like this?


stauersbol
PROOP

2 years ago

I'll see if it works now


brody
EMPLOYEE

2 years ago

I don't know, did they stop hosting their images on dockerhub?


stauersbol
PROOP

2 years ago

They still are


stauersbol
PROOP

2 years ago

but they are also hosting on the github reg


brody
EMPLOYEE

2 years ago

any reason you decided to switch to the ghcr hosted image?


brody
EMPLOYEE

2 years ago

along with going for the base image and not the chrome image


stauersbol
PROOP

2 years ago

oh I didn't I just sent what I saw on the ghcr



stauersbol
PROOP

2 years ago

still on dockerhub


stauersbol
PROOP

2 years ago

okay I switched from the template to the docker image directly


brody
EMPLOYEE

2 years ago

looks like you where correct about the HOST variable


stauersbol
PROOP

2 years ago

Looks like it is not possible to supply "::" as a host value


stauersbol
PROOP

2 years ago

here is the logs


stauersbol
PROOP

2 years ago

just so you can see


brody
EMPLOYEE

2 years ago

have you tried the other host option I mentioned? [::]


stauersbol
PROOP

2 years ago

uhh let me try


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

using [::]


brody
EMPLOYEE

2 years ago

interesting, though that is more progress


brody
EMPLOYEE

2 years ago

wonder why it's trying to do a DNS lookup on its own host?


stauersbol
PROOP

2 years ago

yeah very good question… though it seems like some internal thing?


brody
EMPLOYEE

2 years ago

it needs to not do that lol


brody
EMPLOYEE

2 years ago

have you tried 0.0.0.0 as the HOST?


stauersbol
PROOP

2 years ago

that is the default, but I will try and swap it to that


brody
EMPLOYEE

2 years ago

I thought 127.0.0.1 was the default, as your title says


stauersbol
PROOP

2 years ago

well it looks like i was using v1 of browserless(which is what the template is using)


stauersbol
PROOP

2 years ago

and after swapping to using the docker image directly


stauersbol
PROOP

2 years ago

it swapped to v2


brody
EMPLOYEE

2 years ago

interesting, does this mean it works now?


stauersbol
PROOP

2 years ago

logs now using default


brody
EMPLOYEE

2 years ago

okay good sign, no errors


stauersbol
PROOP

2 years ago

other thing they also did was make a separate image for chormium


stauersbol
PROOP

2 years ago

I was using the chrome image, which could also be why it does not connect


brody
EMPLOYEE

2 years ago

why would chrome Vs chromium cause it not to connect?


stauersbol
PROOP

2 years ago

idk just reading the docs on the service said to swap it to use [ghcr.io/browserless/chromium](ghcr.io/browserless/chromium)


stauersbol
PROOP

2 years ago

instead of [ghcr.io/browserless/chrome](ghcr.io/browserless/chrome)


stauersbol
PROOP

2 years ago

idk what difference it makes


brody
EMPLOYEE

2 years ago

have you tried to connect to it yet?


stauersbol
PROOP

2 years ago

yes


stauersbol
PROOP

2 years ago

when I used the chrome specific image


stauersbol
PROOP

2 years ago

and it still didn't work


brody
EMPLOYEE

2 years ago

what is the url you are trying to connect to it with?


stauersbol
PROOP

2 years ago

so swapped to chromium image to see if that was the cause


stauersbol
PROOP

2 years ago

ws://[browserless-production-9cdd.up.railway.app/playwright/chromium](browserless-production-9cdd.up.railway.app/playwright/chromium) as an external right now


brody
EMPLOYEE

2 years ago

you need to use wss


stauersbol
PROOP

2 years ago

ah yeah


brody
EMPLOYEE

2 years ago

railway is ssl only


stauersbol
PROOP

2 years ago

With connection tries


brody
EMPLOYEE

2 years ago

what is the url you are trying to connect to it with?


stauersbol
PROOP

2 years ago

wss://[browserless-production-9cdd.up.railway.app/chromium/playwright](browserless-production-9cdd.up.railway.app/chromium/playwright)


stauersbol
PROOP

2 years ago

please note


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

docs says it can take either way of that URL


stauersbol
PROOP

2 years ago

could "PORT" be the issue here?


stauersbol
PROOP

2 years ago

as I had it set to 3000


brody
EMPLOYEE

2 years ago

is that not the port browserless runs on?


stauersbol
PROOP

2 years ago

uhh you can change it


stauersbol
PROOP

2 years ago

with a env var


brody
EMPLOYEE

2 years ago

right but what's the default port browserless runs on


stauersbol
PROOP

2 years ago

default is 3000


stauersbol
PROOP

2 years ago

since I have set a external URL I can simply just try and connect to it with the generated URL


brody
EMPLOYEE

2 years ago

your url is incorrect, it was changed in v2 according to their migration guide

it should be /playwright/chromium


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

still says it can't see it


stauersbol
PROOP

2 years ago

I'm gonna try with connectOverCDP


brody
EMPLOYEE

2 years ago

what's cdp?


stauersbol
PROOP

2 years ago

no


brody
EMPLOYEE

2 years ago

sorry, typo


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

what the docs gives


stauersbol
PROOP

2 years ago

ignoring ws as that should be wss


brody
EMPLOYEE

2 years ago

can't hurt to try


stauersbol
PROOP

2 years ago

well that did nothing


stauersbol
PROOP

2 years ago

as in no logs or anything


brody
EMPLOYEE

2 years ago

was worth a try


stauersbol
PROOP

2 years ago

yeah idk why it keep saying it couldn't get that URL…


brody
EMPLOYEE

2 years ago

are you specifying a token?


stauersbol
PROOP

2 years ago

nope


brody
EMPLOYEE

2 years ago

try doing so


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

with token


stauersbol
PROOP

2 years ago

I'm at a loss of how to fix this


brody
EMPLOYEE

2 years ago

im trying some things, but i am going to leave the house soon so im not sure how much i will be able to get done


stauersbol
PROOP

2 years ago

yeah that is alright, no rush on this


brody
EMPLOYEE

2 years ago

im not seeing how this is a limitation of railway, very likely just have some minor config wrong


stauersbol
PROOP

2 years ago

yeah, its just odd


brody
EMPLOYEE

2 years ago

indeed


stauersbol
PROOP

2 years ago

Funny.

I just tried running a websocket connect in Insomnium and it gets a 400…


brody
EMPLOYEE

2 years ago

what happens when you just open the /docs endpoint in your browser


stauersbol
PROOP

2 years ago

This


stauersbol
PROOP

2 years ago

I've been on it for a good while now


brody
EMPLOYEE

2 years ago

okay that at least works


stauersbol
PROOP

2 years ago

I tried not having any proxy/external set as a env var as I had before


stauersbol
PROOP

2 years ago

and I can still access this site without any issues


stauersbol
PROOP

2 years ago

It's just so odd playwright wants to try and use some HTTP request?


stauersbol
PROOP

2 years ago

and not just go straight to using websocket..


brody
EMPLOYEE

2 years ago

works fine for me


stauersbol
PROOP

2 years ago

hmm……..


brody
EMPLOYEE

2 years ago

show me all your variables as shown in the raw editor


stauersbol
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

here are mine

and my url used in my code looks like wss:///playwright/chromium?token=


stauersbol
PROOP

2 years ago

Okay let me try that out


stauersbol
PROOP

2 years ago

are you using the docker image directly?


stauersbol
PROOP

2 years ago

or the template


brody
EMPLOYEE

2 years ago

and remind me again, what is the current image you are using? im using [ghcr.io/browserless/chromium:latest](ghcr.io/browserless/chromium:latest)


stauersbol
PROOP

2 years ago

that is the same as mine


brody
EMPLOYEE

2 years ago

i deployed all this from scratch


stauersbol
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

not that it would technically matter since at this point you are using the same image as me


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

I can do a full redeploy


stauersbol
PROOP

2 years ago

and see what that does


brody
EMPLOYEE

2 years ago

show me your raw variables?


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

I did a redeploy with using the ghcr image link you sent


stauersbol
PROOP

2 years ago

Just wondering if there would be a difference between these 2


brody
EMPLOYEE

2 years ago

for all intensive purposes, not specifying the :latest tag should be the same as specifying the :latest tag, but can't hurt to try


stauersbol
PROOP

2 years ago

no difference


stauersbol
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

show me your code?


stauersbol
PROOP

2 years ago

I'm using bun, but I don't think that should make an awful lot of a difference


brody
EMPLOYEE

2 years ago

oh bun, who knows, i've seen bun do some funky stuff


brody
EMPLOYEE

2 years ago

its still javascript so lets see the code anyway


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

Pretty much how it stands right now


stauersbol
PROOP

2 years ago

Don't mind the top require one, I was just seeing if import and require had some quirky difference


stauersbol
PROOP

2 years ago

but still same behaviour


brody
EMPLOYEE

2 years ago

would you be interested in trying their example code with node instead of bun?


brody
EMPLOYEE

2 years ago

always good to first get a minimal example working!


stauersbol
PROOP

2 years ago

yeah let me spin up a minimal project then


stauersbol
PROOP

2 years ago

huh…


stauersbol
PROOP

2 years ago

that worked?


brody
EMPLOYEE

2 years ago

okay now run the same example code on bun?


stauersbol
PROOP

2 years ago

ahaaa


stauersbol
PROOP

2 years ago

<:ICANT:1010977143771111434>


stauersbol
PROOP

2 years ago

so Bun just hangs when it tries to connect


stauersbol
PROOP

2 years ago

while node does not


stauersbol
PROOP

2 years ago

interesting…


stauersbol
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

thats running the same example code with bun?


stauersbol
PROOP

2 years ago

guess that is a bun thing then


stauersbol
PROOP

2 years ago

yes


stauersbol
PROOP

2 years ago

and its just hanging


stauersbol
PROOP

2 years ago

so this is a bun quirk


brody
EMPLOYEE

2 years ago

alrightly bun issue then


brody
EMPLOYEE

2 years ago

how fun


stauersbol
PROOP

2 years ago

Just really pain for me


stauersbol
PROOP

2 years ago

as I don't want to rewrite my whole project


brody
EMPLOYEE

2 years ago

you use bun apis?


stauersbol
PROOP

2 years ago

Nope


stauersbol
PROOP

2 years ago

None


stauersbol
PROOP

2 years ago

besides bun run --watch


stauersbol
PROOP

2 years ago

which is only locally


brody
EMPLOYEE

2 years ago

so then why would a rewrite be needed? just switch to node?


stauersbol
PROOP

2 years ago

the production code is just running node dist/index.js


stauersbol
PROOP

2 years ago

as I'm using tsup to compile(transpile) to js


stauersbol
PROOP

2 years ago

right okay then its just something for local


stauersbol
PROOP

2 years ago

good to know


stauersbol
PROOP

2 years ago


stauersbol
PROOP

2 years ago

I had it like this before


stauersbol
PROOP

2 years ago

and I wanted to test browserless locally with bun


stauersbol
PROOP

2 years ago

which then caused this mess


stauersbol
PROOP

2 years ago

oh well


brody
EMPLOYEE

2 years ago

well problem solved though!


stauersbol
PROOP

2 years ago

yes!


stauersbol
PROOP

2 years ago

thank you for sticking with me 😂


stauersbol
PROOP

2 years ago

and spending so much time on this


brody
EMPLOYEE

2 years ago

happy to help!


brody
EMPLOYEE

2 years ago

problem solved, and now you also have a v2 browserless deploy that can be used with node


stauersbol
PROOP

2 years ago

Yes


stauersbol
PROOP

2 years ago

the production command is node dist/index.js


stauersbol
PROOP

2 years ago

so it doesn't rely on bun


brody
EMPLOYEE

2 years ago

time to change that token too!


stauersbol
PROOP

2 years ago

ah yes true


stauersbol
PROOP

2 years ago

feel free to close this issue now


stauersbol
PROOP

2 years ago

I can't mark it as solved somehow


brody
EMPLOYEE

2 years ago

that seems like a good message to mark as solved haha


Loading...