Error using playwright on project
luiskurihara
PROOP

2 years ago

I´ve trying to deploy my scraping server, but the railway faild building e deploying

here is the log system and my dependencies in package json

I have authorization to scrapy, plus it's public data

"dependencies": {
"axios": "^1.6.8",
"dotenv": "^16.4.5",
"env-var": "^7.4.1",
"fs": "^0.0.1-security",
"jsdom": "^24.0.0",
"node-cron": "^3.0.3",
"node-schedule": "^2.1.1",
"nodemailer": "^6.9.13",
"openai": "^4.29.2",
"pg": "^8.11.3",
"playwright": "^1.42.1",
"prompt-sync": "^4.2.0",
"sequelize": "^6.37.1"
}

100 Replies

luiskurihara
PROOP

2 years ago

90126b32-7716-4f6e-8326-00312abc6db6


luiskurihara
PROOP

2 years ago

Error using playwright on project


brody
EMPLOYEE

2 years ago

I can not recommend using Browserless enough, using it means you don't have to install Chrome and all of its needed dependencies into your container, and this will significantly speed up both the build and the publishing stage.

Browserless template here - https://railway.app/template/browserless

And here's my little example repo that shows you how to use browserless with playwright - https://github.com/brody192/playwright-example


luiskurihara
PROOP

2 years ago

ok but


brody
EMPLOYEE

2 years ago

but?


luiskurihara
PROOP

2 years ago

where i can find this env


luiskurihara
PROOP

2 years ago

WSENDPOINTPLAYWRIGHT=${{Browserless.WSENDPOINTPLAYWRIGHT}}


luiskurihara
PROOP

2 years ago

this


luiskurihara
PROOP

2 years ago

'WSENDPOINTPLAYWRIGHT"


luiskurihara
PROOP

2 years ago

the template do it?


brody
EMPLOYEE

2 years ago

yes that's provided by the template


luiskurihara
PROOP

2 years ago

okayy


luiskurihara
PROOP

2 years ago

i will try


luiskurihara
PROOP

2 years ago

how i can use this template?


luiskurihara
PROOP

2 years ago

just click on 'Deploy Now'?


luiskurihara
PROOP

2 years ago

i never use template on railway


brody
EMPLOYEE

2 years ago

nope, open your pre-existing project and click the + New button and search for the template


luiskurihara
PROOP

2 years ago

okay


luiskurihara
PROOP

2 years ago

and click deploy?


brody
EMPLOYEE

2 years ago

yes, as long as you follow my instructions


luiskurihara
PROOP

2 years ago

1223296561849569500


brody
EMPLOYEE

2 years ago

looks good!


luiskurihara
PROOP

2 years ago

and just change like this:


luiskurihara
PROOP

2 years ago

const browser = await playwright.chromium.connect(process.env.WSENDPOINTPLAYWRIGHT);


brody
EMPLOYEE

2 years ago

yep that looks right


brody
EMPLOYEE

2 years ago

you'd also want to remove your custom build command that tries to install chrome


luiskurihara
PROOP

2 years ago

hey brody good night, I ended up leaving home and only returned now


luiskurihara
PROOP

2 years ago

same error using browserless


luiskurihara
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

build logs please


luiskurihara
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

okay and show me your playwright.chromium code please


luiskurihara
PROOP

2 years ago


brody
EMPLOYEE

2 years ago

are you sure you arent calling chromium.launch elsewhere?


luiskurihara
PROOP

2 years ago

yes, have other functions


luiskurihara
PROOP

2 years ago

all i ve changed


luiskurihara
PROOP

2 years ago

but this are the first


brody
EMPLOYEE

2 years ago

your code is still trying to launch chrome


luiskurihara
PROOP

2 years ago

and have the error


luiskurihara
PROOP

2 years ago

Do I have to set up any ENV variables?


luiskurihara
PROOP

2 years ago

this WSENDPOINTPLAYWRIGHT


brody
EMPLOYEE

2 years ago

yes you do, please read the readme


luiskurihara
PROOP

2 years ago

WSENDPOINTPLAYWRIGHT=${{Browserless.WSENDPOINTPLAYWRIGHT}}


luiskurihara
PROOP

2 years ago

this


luiskurihara
PROOP

2 years ago

correct?


brody
EMPLOYEE

2 years ago

yes, that needs to be set on your app's service


luiskurihara
PROOP

2 years ago

but i dont use app service


luiskurihara
PROOP

2 years ago

i will send you my main.js


luiskurihara
PROOP

2 years ago

it is simple bot


luiskurihara
PROOP

2 years ago


luiskurihara
PROOP

2 years ago

look


luiskurihara
PROOP

2 years ago

just a cron who will run everyday


brody
EMPLOYEE

2 years ago

instead of typing out the name of the service you use i simply said app as a generic cover, i am talking about the service in the top left of this screenshot

1223403111125614600


luiskurihara
PROOP

2 years ago

broo


luiskurihara
PROOP

2 years ago

I don't believe it


brody
EMPLOYEE

2 years ago

what?


luiskurihara
PROOP

2 years ago

I went to check the variable and it was missing a point


brody
EMPLOYEE

2 years ago

that would be an issue


luiskurihara
PROOP

2 years ago

I changed it and now it's gone


luiskurihara
PROOP

2 years ago

I'm sorry


luiskurihara
PROOP

2 years ago

how i can pay you?


luiskurihara
PROOP

2 years ago

for this help


brody
EMPLOYEE

2 years ago

theres no need for pay lol


luiskurihara
PROOP

2 years ago

okay


luiskurihara
PROOP

2 years ago

i ve looking for browserless website


brody
EMPLOYEE

2 years ago

i appreciate the offer though ❤️


luiskurihara
PROOP

2 years ago

and i saw the 'pricing'


brody
EMPLOYEE

2 years ago

well now you are self-hosting it, so you only have to pay railway's usage pricing


luiskurihara
PROOP

2 years ago

okay thats right


luiskurihara
PROOP

2 years ago

I don't know if you noticed, but I'm from Brazil so bad English ahaha


brody
EMPLOYEE

2 years ago

nah your english is fine


luiskurihara
PROOP

2 years ago


luiskurihara
PROOP

2 years ago

this is common?


luiskurihara
PROOP

2 years ago

to much issues now


brody
EMPLOYEE

2 years ago

is your service not working?


luiskurihara
PROOP

2 years ago

yes


brody
EMPLOYEE

2 years ago

then the logs are normal


luiskurihara
PROOP

2 years ago

are closing the browser


luiskurihara
PROOP

2 years ago

the internet are slow on railway?


luiskurihara
PROOP

2 years ago

i have to change the 'waitforselector'?


luiskurihara
PROOP

2 years ago

look this line 'page.waitForTimeout: page.waitForSelector: page.waitForSelector: Target page, context or browser has been closed'


brody
EMPLOYEE

2 years ago

browserless closes its chromium browser when not in use to save on resources


luiskurihara
PROOP

2 years ago

but it was in 100% use, i didn't understand mt well i'm going to change the codes and test again


brody
EMPLOYEE

2 years ago

each call to chromium.connect would spawn another browser and then it would get closed, if your service works fine, then theres nothing to worry about


luiskurihara
PROOP

2 years ago

my service isn't working it's taking 1/8 of the data


brody
EMPLOYEE

2 years ago

im not sure what "1/8 of the data" means


luiskurihara
PROOP

2 years ago

it is dosent working hahaha


luiskurihara
PROOP

2 years ago

i dont know why the browser are closing


luiskurihara
PROOP

2 years ago

i will put more time between functions


brody
EMPLOYEE

2 years ago

the browser is closing because they did what your code asked them to do


luiskurihara
PROOP

2 years ago

running here on my computer locally it works now online it closes


brody
EMPLOYEE

2 years ago

thats how browserless works


luiskurihara
PROOP

2 years ago

same issues here


luiskurihara
PROOP

2 years ago

i dont know what is going on


luiskurihara
PROOP

2 years ago

beacuse the page are open and the console show this issues: page.waitForTimeout: page.waitForTimeout: page.waitForTimeout: page.waitForTimeout: page.waitForTimeout: page.waitForTimeout: page.waitForTimeout: page.waitForSelector: page.waitForSelector: page.waitForSelector: page.waitForSelector: Target page, context or browser has been closed

at links (/app/pegarlinks_caixa.js:59:24)

at /app/async file:/app/test.js:23:29


luiskurihara
PROOP

2 years ago

i ve put a console.log if page are closed


brody
EMPLOYEE

2 years ago

okay but is that causing your app to not work correctly?


luiskurihara
PROOP

2 years ago

Yes, as it is a site that takes a long time to load there are waitforselector with very long timeouts


luiskurihara
PROOP

2 years ago

how can i change in browserless to stay more on the page?


brody
EMPLOYEE

2 years ago

browserless has it's timeout set at 5 minutes, I can't see you needing more than that


Loading...