Does browslerless support headful mode?
I followed the docs, implemented this and still struggling:
I'm getting: Error: Unexpected server response: 500
Solution:Jump to solution
it works now, and all i did was switch to browserless v1.
stock template, no xvfb....
100 Replies
Project ID:
d2a990ba-9a9a-40aa-9414-f3d1ae9e016f
d2a990ba-9a9a-40aa-9414-f3d1ae9e016f
Note: the above is an example from the docs and not my code (links not configured etc)
railway is a headless environment, so I'd say no its not going to be supported
Oh I see, thanks
Any idea if I can load a stream from a wss in headless mode?
I don't see why not, I also don't see how headless or not would come into play here
The stream I'm trying to load is from my own app - and can change the page I'm visiting with puppeteer
Hm I see, I can't get the wss to load for some reason
How I know the stream isn't loading
hmmm, I don't really know what to tell you here
Any args for me to run that you think might help maybe?
sorry, I don't have any real experience with puppeteer
Okie, thanks anyways :)
@Brody is there any other way you know of to run Browserless in headful mode?
well does something error out when you tell it to run with a head?
It works fine in headful, only issue is with headless
Which it turns out WebRTC streams aren't supported in headless mode
right but can you not run it in headfull mode?
Correct
then there you have it
I also noticed you are using browserless.io, instead of self hosting browserless on railway? not that it would fix anything
Oh I'm using the Railway instance - I just copied that off their docs
ah okay cool
Out of curiosity, why doesn't Railway support headful mode?
it's a docker environment, there are no heads, nothing specific to railway
Oh I see, so if I added something like x11 into the container it would work?
yeah, you'd need to emulate something like that
if you give me several hours, i may be able to implement that for you
Oh!!
I would super super appreciate that
id just need you to provide me with a minimal reducible example that i can run so that tells me / shows me that ive started chrome in headfull mode, of course this example should also provide some indictor or error if i try to start chrome in headfull mode and browserless isnt supporting that, know what i mean?
Sure let me work on that
i say several hours because im just about to head out, so ill work on it when im back
but that gives you time to work on the example!
Works perfectly, thanks a bunch :)
no problem!
mind throwing that in a repo so I can simply run it in a service?
Sure!
full repo that has everything I'd need to trigger that code to run and do it's thing
What's your github?
brody192
Done, just sent over the repo to you
it doesn't look very minimal
I guess it does crash when headful is unsupported while requesting it in the .connect
Will update
Done, just pushed the simplified version
haha I think you are missing the point of minimal
Ok I might be ðŸ˜
What do you mean by it?
not a full project, just like a single script that proves the issue / proves it's fixed
Oh, I thought of doing that but wasn't sure how it would be trigerred on Railway easily
so I resorted to the existing
you'd have your package.json setup properly, right now you have a full app
Sorry about that, want me to rewrite it?
I'd just like a minimal reproducible example, emphasis on minimal
Done, just pushed it
okay perfect, now that's minimal
one question, how have you been able to verify that this code works? run it with your local chrome install instead of browserless?
Yes, I wrote it with normal puppeteer initially and then modified it for browserless
Will test it out again with the minimal version
okay perfect
Seems like there's an issue with some newer updates I made to it, let me fix and push
Okay fixed - when you run local.ts it uses normal puppeteer, when you run index.ts it uses browserless
You'll be able to see the difference it output between the two (and sorry for the hassle - I should have tested the newest version with all the new stuff I added on while debugging)
(Headless always returns a blank screen)
okay cool, what version is going to run by default when deployed to railway?
The browserless version
perf
i dont have bun locally (windows without WSL) so how can i verify that this is not working?
how fast could you add in a web server to serve that image?
I can start the stream, and if the file size increases we'll know it's working
Uint8Array(4190)
would increase?Just a rough guess - let me get back to you on this
Yes it would
might help to have a web server to serve that image?
Okay let me see
i know i said minimal but id still need a way to verify my findings since i cant run this locally
Ofcourse - working on a webserver to serve the image
web server or convert to plain old node, whatever is easier
Pushed
sweet
this was such a good feature
Oh I didn't even know that was a feature
W feature
yeah i mean in this scenario i trust what you are pushing but its a good security feature to have
Yeah 100%
and you said if the image is black its not working?
Correct
If it's just all black and no text/icons
gotcha
Uint8Array(4190) should mean it's working as far as I can tell
But that's just a terrible way to check lol
thats funny since i didnt implement the virtual display server yet
Oh??
are you using browserless v1 or v2
v2
same
Ok we should probs see the result from the endpoint
waiting for dns to update so i can see the image
Nvm, I got mixed up - I have the stream running now so it should be easier to see if it works or not
dns still isnt updated yet lol
You'll see my screen if it's working or a black screen
Oh xD
it is indeed black
https://headful-test-v2-production.up.railway.app/thumbnail/the_winzy
I rlly hope X11 fixes this
me too
:prayge:
Thanks again for all the effort, super appreciate it
of course!
you are running it in headless mode? i thought you wanted headless false?
https://github.com/ashwwwin/headful-test/blob/main/index.ts#L19
Ooops I forgot to change that back
Pushed
awsome
is the stream running?
Yep
still black even with xvfb running
:(
The browserless instance doesn't crash though while connecting with headless: false?
correct
sighs will have to dig in further tomorrow when I get up, almost 9 am for me
great sleep schedule lol
can you leave the stream running?
Could you share an easy way for me to replicate the instance with headful mode on?
For sure
this is what ive done so far
https://github.com/railwayapp-templates/browserless-v2/tree/xvfb
Solution
it works now, and all i did was switch to browserless v1.
stock template, no xvfb.
Interesting - no idea why that works but, thank you so so much
:patrikdab:
Literally saved me from another few days of debugging :)
no problem!