Browserless only listening to 127.0.0.1?
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
129 Replies
Project ID:
8692a59f-3cb6-4863-a67e-c9864cb63401
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
I took a look on the /sessions page to see what endpoint it was using and it uses:
Plus I am getting this also
I'm gonna try adding the env vars to the project specifically instead inside of the Dockerfile
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 railwayWould I need to specific that as a
HOST
env?unfortunately I am uncertain on how you would configure what host browserless runs on
for that, you would need to reference their documentation
Alright
Seems like it is just
HOST
as an environment variableI assume you are using the browserless template?
Uh yes
Well I had to redeploy, but yes
that template is very old and thus made long before railway had private networking
you are not the first to have issues using it
Yes, but it uses the latest docker image
yes, but it's missing the correct configurations to use it
in fact it's so old, it deploys from a Dockerfile when it should be just a docker image without a github repository
ghcr.io/browserless/base:latest
something like this?
I'll see if it works nowI don't know, did they stop hosting their images on dockerhub?
They still are
but they are also hosting on the github reg
any reason you decided to switch to the ghcr hosted image?
along with going for the base image and not the chrome image
oh I didn't I just sent what I saw on the ghcr
https://hub.docker.com/r/browserless/chrome
still on dockerhub
okay I switched from the template to the docker image directly
looks like you where correct about the
HOST
variable
https://www.browserless.io/docs/docker#defining-a-host-bindLooks like it is not possible to supply "::" as a host value
here is the logs
just so you can see
have you tried the other host option I mentioned?
[::]
uhh let me try
using
[::]
interesting, though that is more progress
wonder why it's trying to do a DNS lookup on its own host?
yeah very good question... though it seems like some internal thing?
it needs to not do that lol
have you tried 0.0.0.0 as the HOST?
that is the default, but I will try and swap it to that
I thought 127.0.0.1 was the default, as your title says
well it looks like i was using v1 of browserless(which is what the template is using)
and after swapping to using the docker image directly
it swapped to v2
interesting, does this mean it works now?
logs now using default
okay good sign, no errors
other thing they also did was make a separate image for chormium
I was using the chrome image, which could also be why it does not connect
why would chrome Vs chromium cause it not to connect?
idk just reading the docs on the service said to swap it to use
ghcr.io/browserless/chromium
instead of ghcr.io/browserless/chrome
idk what difference it makeshave you tried to connect to it yet?
yes
when I used the chrome specific image
and it still didn't work
what is the url you are trying to connect to it with?
so swapped to chromium image to see if that was the cause
ws://browserless-production-9cdd.up.railway.app/playwright/chromium
as an external right nowyou need to use
wss
ah yeah
railway is ssl only
With connection tries
what is the url you are trying to connect to it with?
wss://browserless-production-9cdd.up.railway.app/chromium/playwright
please notedocs says it can take either way of that URL
could "PORT" be the issue here?
as I had it set to 3000
is that not the port browserless runs on?
uhh you can change it
with a env var
right but what's the default port browserless runs on
default is 3000
since I have set a external URL I can simply just try and connect to it with the generated URL
your url is incorrect, it was changed in v2 according to their migration guide
https://github.com/browserless/browserless/blob/main/MIGRATION-2.0.md#browserless-20-migration-guide
it should be
/playwright/chromium
still says it can't see it
I'm gonna try with connectOverCDP
what's cdp?
no
sorry, typo
what the docs gives
ignoring
ws
as that should be wss
can't hurt to try
well that did nothing
as in no logs or anything
was worth a try
yeah idk why it keep saying it couldn't get that URL...
are you specifying a token?
nope
try doing so
with token
I'm at a loss of how to fix this
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
yeah that is alright, no rush on this
im not seeing how this is a limitation of railway, very likely just have some minor config wrong
yeah, its just odd
indeed
Funny.
I just tried running a websocket connect in Insomnium and it gets a 400...
what happens when you just open the /docs endpoint in your browser
This
I've been on it for a good while now
okay that at least works
I tried not having any proxy/external set as a env var as I had before
and I can still access this site without any issues
It's just so odd playwright wants to try and use some HTTP request?
and not just go straight to using websocket..
works fine for me
hmm........
show me all your variables as shown in the raw editor
here are mine
and my url used in my code looks like
wss://<domain>/playwright/chromium?token=<token>
Okay let me try that out
are you using the docker image directly?
or the template
and remind me again, what is the current image you are using? im using
ghcr.io/browserless/chromium:latest
that is the same as mine
i deployed all this from scratch
not that it would technically matter since at this point you are using the same image as me
I can do a full redeploy
and see what that does
show me your raw variables?
I did a redeploy with using the ghcr image link you sent
Just wondering if there would be a difference between these 2
for all intensive purposes, not specifying the :latest tag should be the same as specifying the :latest tag, but can't hurt to try
no difference
show me your code?
I'm using bun, but I don't think that should make an awful lot of a difference
oh bun, who knows, i've seen bun do some funky stuff
its still javascript so lets see the code anyway
Pretty much how it stands right now
Don't mind the top require one, I was just seeing if import and require had some quirky difference
but still same behaviour
would you be interested in trying their example code with node instead of bun?
https://www.browserless.io/docs/playwright#javascript-playwright
always good to first get a minimal example working!
yeah let me spin up a minimal project then
huh...
that worked?
okay now run the same example code on bun?
ahaaa
:ICANT:
Solution
so Bun just hangs when it tries to connect
while node does not
interesting...
thats running the same example code with bun?
guess that is a bun thing then
yes
and its just hanging
so this is a bun quirk
alrightly bun issue then
how fun
Just really pain for me
as I don't want to rewrite my whole project
you use bun apis?
Nope
None
besides bun run --watch <filename here>
which is only locally
so then why would a rewrite be needed? just switch to node?
the production code is just running
node dist/index.js
as I'm using tsup to compile(transpile) to js
right okay then its just something for local
good to know
I had it like this before
and I wanted to test browserless locally with bun
which then caused this mess
oh wellwell problem solved though!
yes!
thank you for sticking with me 😂
and spending so much time on this
happy to help!
problem solved, and now you also have a v2 browserless deploy that can be used with node
Yes
the production command is
node dist/index.js
so it doesn't rely on buntime to change that token too!
ah yes true
feel free to close this issue now
I can't mark it as solved somehow
that seems like a good message to mark as solved haha