Error using playwright on project

luiskuriharaPRO

a year 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"
}

0 Replies

luiskuriharaPRO

a year ago

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


luiskuriharaPRO

a year ago

Error using playwright on project


a year 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


luiskuriharaPRO

a year ago

ok but


a year ago

but?


luiskuriharaPRO

a year ago

where i can find this env


luiskuriharaPRO

a year ago

WSENDPOINTPLAYWRIGHT=${{Browserless.WSENDPOINTPLAYWRIGHT}}


luiskuriharaPRO

a year ago

this


luiskuriharaPRO

a year ago

'WSENDPOINTPLAYWRIGHT"


luiskuriharaPRO

a year ago

the template do it?


a year ago

yes that's provided by the template


luiskuriharaPRO

a year ago

okayy


luiskuriharaPRO

a year ago

i will try


luiskuriharaPRO

a year ago

how i can use this template?


luiskuriharaPRO

a year ago

just click on 'Deploy Now'?


luiskuriharaPRO

a year ago

i never use template on railway


a year ago

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


luiskuriharaPRO

a year ago

okay


luiskuriharaPRO

a year ago

and click deploy?


a year ago

yes, as long as you follow my instructions


luiskuriharaPRO

a year ago

1223296561849569500


a year ago

looks good!


luiskuriharaPRO

a year ago

and just change like this:


luiskuriharaPRO

a year ago

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


a year ago

yep that looks right


a year ago

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


luiskuriharaPRO

a year ago

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


luiskuriharaPRO

a year ago

same error using browserless


luiskuriharaPRO

a year ago


a year ago

build logs please


luiskuriharaPRO

a year ago


a year ago

okay and show me your playwright.chromium code please


luiskuriharaPRO

a year ago


a year ago

are you sure you arent calling chromium.launch elsewhere?


luiskuriharaPRO

a year ago

yes, have other functions


luiskuriharaPRO

a year ago

all i ve changed


luiskuriharaPRO

a year ago

but this are the first


a year ago

your code is still trying to launch chrome


luiskuriharaPRO

a year ago

and have the error


luiskuriharaPRO

a year ago

Do I have to set up any ENV variables?


luiskuriharaPRO

a year ago

this WSENDPOINTPLAYWRIGHT


a year ago

yes you do, please read the readme


luiskuriharaPRO

a year ago

WSENDPOINTPLAYWRIGHT=${{Browserless.WSENDPOINTPLAYWRIGHT}}


luiskuriharaPRO

a year ago

this


luiskuriharaPRO

a year ago

correct?


a year ago

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


luiskuriharaPRO

a year ago

but i dont use app service


luiskuriharaPRO

a year ago

i will send you my main.js


luiskuriharaPRO

a year ago

it is simple bot


luiskuriharaPRO

a year ago


luiskuriharaPRO

a year ago

look


luiskuriharaPRO

a year ago

just a cron who will run everyday


a year 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


luiskuriharaPRO

a year ago

broo


luiskuriharaPRO

a year ago

I don't believe it


a year ago

what?


luiskuriharaPRO

a year ago

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


a year ago

that would be an issue


luiskuriharaPRO

a year ago

I changed it and now it's gone


luiskuriharaPRO

a year ago

I'm sorry


luiskuriharaPRO

a year ago

how i can pay you?


luiskuriharaPRO

a year ago

for this help


a year ago

theres no need for pay lol


luiskuriharaPRO

a year ago

okay


luiskuriharaPRO

a year ago

i ve looking for browserless website


a year ago

i appreciate the offer though ❤️


luiskuriharaPRO

a year ago

and i saw the 'pricing'


a year ago

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


luiskuriharaPRO

a year ago

okay thats right


luiskuriharaPRO

a year ago

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


a year ago

nah your english is fine


luiskuriharaPRO

a year ago


luiskuriharaPRO

a year ago

this is common?


luiskuriharaPRO

a year ago

to much issues now


a year ago

is your service not working?


luiskuriharaPRO

a year ago

yes


a year ago

then the logs are normal


luiskuriharaPRO

a year ago

are closing the browser


luiskuriharaPRO

a year ago

the internet are slow on railway?


luiskuriharaPRO

a year ago

i have to change the 'waitforselector'?


luiskuriharaPRO

a year ago

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


a year ago

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


luiskuriharaPRO

a year ago

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


a year 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


luiskuriharaPRO

a year ago

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


a year ago

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


luiskuriharaPRO

a year ago

it is dosent working hahaha


luiskuriharaPRO

a year ago

i dont know why the browser are closing


luiskuriharaPRO

a year ago

i will put more time between functions


a year ago

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


luiskuriharaPRO

a year ago

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


a year ago

thats how browserless works


luiskuriharaPRO

a year ago

same issues here


luiskuriharaPRO

a year ago

i dont know what is going on


luiskuriharaPRO

a year 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


luiskuriharaPRO

a year ago

i ve put a console.log if page are closed


a year ago

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


luiskuriharaPRO

a year ago

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


luiskuriharaPRO

a year ago

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


a year ago

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