Browserless reference variables don't work using template
lucasgelfond
PROOP

a year ago

Hiya! Left this note in the template GH issues, but imagining more likely to get seen here:

Hacking on a side project, works locally when I run this with a Browserless docker image and uvicorn, once deployed to Railway, using reference variables, no luck. Added them in using the "Reference Variables" UI, but they show up after as empty strings, no other way to add.

LOCALLY, my working variables are:

BROWSER_TOKEN=""  # Leave empty for local Docker
BROWSER_WEBDRIVER_ENDPOINT="http://localhost:3000/webdriver"

Screenshot 2025-01-11 at 1 03 11 PM

Screenshot 2025-01-11 at 1 03 44 PM

These don't seem to be settable, even though I'm doing them exactly as it seems to be specified:

Screenshot 2025-01-11 at 12 59 16 PMScreenshot 2025-01-11 at 12 59 20 PM

i.e. like this, however, it shows up as <empty string> when i press enter

Screenshot 2025-01-11 at 12 59 09 PM

Solved

21 Replies

a year ago

Hello,

Given you now have the reference variables set correctly now, I'm going to take a guess and say that you deployed browserless into its own separate isolated project?


Status changed to Awaiting User Response Railway about 1 year ago


brody

Hello,Given you now have the reference variables set correctly now, I'm going to take a guess and say that you deployed browserless into its own separate isolated project?

lucasgelfond
PROOP

a year ago

Yes! Sorry, should have updated. Created the template and copied stuff over. Thanks so much!


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Awsome!

Need help with anything else?


Status changed to Awaiting User Response Railway about 1 year ago


brody

Awsome!Need help with anything else?

lucasgelfond
PROOP

a year ago

Yes, actually! Browserless actually doesn't seem to be working as expected.

Basically, the arch of my app is that I have a server which queues a bunch of scraping / Browserless tasks using RabbitMQ, and then a bunch of consumers (I'll use Railway replicas when I scale this up) which actually complete them.

My consumers work perfectly locally, but in Railway no luck. I've tried manually copy-pasting the resolved ENV variables from the Browserless template, and that doesn't seem to do it.

For example, working version locally:

Non-working version on railway — you'll note, consumes tasks perfectly, just seems like a Browserless problem.

PS — Railway is really amazing! And I've been using a ton of your templates, thanks so much for all of this! Makes it way easier to hack on side projects without having to manage a bunch of infra


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Are you using Browserless locally?


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Yes I am! I'm running the exact stuff I'm using on Railway locally / without problem


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Are you running the same Browserless version on Railway? there are two templates for Railway, Browserless v1 and v2


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Hmm...I'm using browserless/chrome:latest locally I believe, although I seem to be connecting to browserless in a version-agnostic way. I think I might be a bit confused about how the template work here. My assumption was that I need the Browserless template running so that I can pass the BROWSERLESS_WEBDRIVER_ENDPOINT to my regular / vanilla node server, and it can make calls to browserless. (I.e. this is the only part of teh template I'm using). I was using the Browserless v2 template, but tried with V1 (copy-pasting the Raw Editor env variables) and also no luck. Any ideas?

(Thanks so much for help here, just not quite sure what is going on!)


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

On Railway you are using ghcr.io/browserless/chromium so thats browserless v2 that uses Chromium.

There are some examples repos here -

https://railway.com/template/0jqemX

If your library and language isn't there, I can try to add it.


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Ok wait, i think i must be confused!

Library / language almost certainly is there - I'm just using JS! Browserless v2 should be running, and I'm using all of your default env variables, I believe. For some reason, my node backend can't seem to use browserless - why would this be? I am almost certain this is a railway networking / setup thing, although also possibly unrelated user error (but I think unlikely, because all working locally! The only issue is getting local to run on Railway infra


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Have you successfully used Browserless hosted on Railway with locally running code?


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

I did earlier, but I'm not seeming to have some trouble! A few things I did:
- Copied your Selenium / Node example, put it into railway with a few of my changes (I had it start to screenshot my website / upload it to Cloudinary as a test). Attached error, not sure exactly what's going on, but it's basically the boilerplate.
- Added some logs to my local code (that I believe I started with the template). To confirm: I have my Node project that is NOT the Browserless template (it's a RabbitMQ consumer), and separately, the Browserless template deployed. Theoretically the Node consumer can call / control the Browserless instance, but in practice no.

(Also, separately, seems like Browserless does queueing, and I maybe didn't need this. Either way though, I can't get just vanilla Browserless running as is, so maybe something else is wrong / something with my configuration is wrong?)

Thank you for your help!


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

You are using Browserless v2, v2 has dropped support for Selenium, you need to be using v1.


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Ah! Thank you, didn't realize that! Perfect


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Working now?


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Nope, no luck sadly. I:
- Swapped Browserless for v1
- Swapped the BROWSER_TOKEN and BROWSER_WEBDRIVER_ENDPOINT on each of the services that needs to access browserless to the stuff generated by Browserless (is this correct? btw this manual process, if so, is fairly clunky - i.e. have to manually reveal the endpoints on the Browserless service and copy over, and can't use the raw editor because they are template variables)

Getting this now:

Attachments


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

You can just click the + New Variable button, start typing and it will autocomplete for you, no need to manually copy anything.

Are you able to run this code locally by having it connect to the Browserless instance hosted on Railway?

You have also manually modified the variables the Browserless template comes with, I'm not sure why that was done?


Status changed to Awaiting User Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

Ok I think I see!

I actually just started an unrelated project for work that has similar functionality (the former was a personal proj)

I guess I'm confused:
- do I deploy a Browserless template and then separately deploy my service?

OR

- do i deploy a Browserless template, and then change the source Git repo to my version of the selenium example?

I tried the first way, and copy-pasted all of the ENV variables from the raw editor to my service. When I hit the endpoint externally, I get:
```
{

"error": "Invalid URL: https:///webdriver"

}
```

When I try the second way, it doesn't re-deploy on pushes, seems like the first is correct?

Sorry for all of this back and forth, hoping to figure out both asap!


Status changed to Awaiting Railway Response Railway about 1 year ago


lucasgelfond
PROOP

a year ago

(This one, confirmed, works locally)


lucasgelfond
PROOP

a year ago

(Also separately just want to confirm, there's "iron wall" separation between my personal projects (on my account) and my team projects. Want to make sure company doesn't get billed for my personal usage (or vice versa)


a year ago

You would want to deploy Browserless and then your own app in a separate service.

Please do not copy and paste any variables, that url is incorrect, use the reference variables by letting it autocomplete.

Personal and Team workspaces have completely separate billing, yes.


Status changed to Awaiting User Response Railway about 1 year ago


Railway
BOT

7 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 7 months ago


Loading...