Mismatch between browserless chrome and playwright

kc1TRIAL

3 months ago

Hi,

I'm trying to deploy a node app that takes screenshots. I need chrome for this and and after reading multiple threads on this site, I realized that the preferred way to set this up is by using a browserless app. Following 1 of the threads, I believe I set it up (https://help.railway.com/questions/railway-run-mini-server-scraping-using-c-ee752433) with the following code:

async function launchBrowser(headless = true) {
  let browser;
  if (process.env.BROWSER_PLAYWRIGHT_ENDPOINT) {
    browser = await chromium.connect(process.env.BROWSER_PLAYWRIGHT_ENDPOINT);
  } else {
    browser = await chromium.launch({ headless: headless });
  }

  return browser;
}

However when I run it I see;

{
    "error": "browserType.connect: WebSocket error: wss://browserless-production-cc9a.up.railway.app/playwright 428 Precondition Required\n╔════════════════════════════════════════════════════╗\n║ Playwright version mismatch:                       ║\n║   - server version: v1.41                          ║\n║   - client version: v1.50                          ║\n║                                                    ║\n║ If you are using VSCode extension, restart VSCode. ║\n║                                                    ║\n║ If you are connecting to a remote service,         ║\n║ keep your local Playwright version in sync         ║\n║ with the remote service version.                   ║\n║                                                    ║\n║ <3 Playwright Team                                 ║\n╚════════════════════════════════════════════════════╝\nCall log:\n  - <ws connecting> wss://browserless-production-cc9a.up.railway.app/playwright\n  - <ws unexpected response> wss://browserless-production-cc9a.up.railway.app/playwright 428 Precondition Required\n╔════════════════════════════════════════════════════╗\n║ Playwright version mismatch:                       ║\n║   - server version: v1.41                          ║\n║   - client version: v1.50                          ║\n║                                                    ║\n║ If you are using VSCode extension, restart VSCode. ║\n║                                                    ║\n║ If you are connecting to a remote service,         ║\n║ keep your local Playwright version in sync         ║\n║ with the remote service version.                   ║\n║                                                    ║\n║ <3 Playwright Team                                 ║\n╚════════════════════════════════════════════════════╝\n  - <ws error> wss://browserless-production-cc9a.up.railway.app/playwright error WebSocket was closed before the connection was established\n  - <ws connect error> wss://browserless-production-cc9a.up.railway.app/playwright WebSocket was closed before the connection was established\n  - <ws disconnected> wss://browserless-production-cc9a.up.railway.app/playwright code=1006 reason=\n"
}

Give the mismatch I tried to change my package.json to "dependencies": {
    .....
    "express": "^4.21.2",
    "node-fetch": "^2.7.0",
    "playwright": "1.41.1-beta-1706549589000",

but the problem persists. Any way to fix this?
Solved

7 Replies

3 months ago

Hello,

Looks like your latest deploy is online without any error logs so I'll mark this as solved, feel free to re-open if that's not the case.


Status changed to Awaiting User Response railway[bot] 3 months ago


Status changed to Solved brody 3 months ago


Status changed to Awaiting Railway Response kc1 3 months ago


brody

Hello,Looks like your latest deploy is online without any error logs so I'll mark this as solved, feel free to re-open if that's not the case.

kc1TRIAL

3 months ago

Hi Brody, the project does build, but I am now getting: {

"error": "browserType.connect: WebSocket error: wss://browserless-production-cc9a.up.railway.app/playwright 428 Precondition Required\n╔════════════════════════════════════════════════════╗\n║ Playwright version mismatch: ║\n║ - server version: v1.41 ║\n║ - client version: v1.50 ║\n║ ║\n║ If you are using VSCode extension, restart VSCode. ║\n║ ║\n║ If you are connecting to a remote service, ║\n║ keep your local Playwright version in sync ║\n║ with the remote service version. ║\n║ ║\n║ <3 Playwright Team ║\n╚════════════════════════════════════════════════════╝\nCall log:\n - <ws connecting> wss://browserless-production-cc9a.up.railway.app/playwright\n - <ws unexpected response> wss://browserless-production-cc9a.up.railway.app/playwright 428 Precondition Required\n╔════════════════════════════════════════════════════╗\n║ Playwright version mismatch: ║\n║ - server version: v1.41 ║\n║ - client version: v1.50 ║\n║ ║\n║ If you are using VSCode extension, restart VSCode. ║\n║ ║\n║ If you are connecting to a remote service, ║\n║ keep your local Playwright version in sync ║\n║ with the remote service version. ║\n║ ║\n║ <3 Playwright Team ║\n╚════════════════════════════════════════════════════╝\n - <ws error> wss://browserless-production-cc9a.up.railway.app/playwright error WebSocket was closed before the connection was established\n - <ws connect error> wss://browserless-production-cc9a.up.railway.app/playwright WebSocket was closed before the connection was established\n - <ws disconnected> wss://browserless-production-cc9a.up.railway.app/playwright code=1006 reason=\n"

}

How can I fix this?


3 months ago

From those logs -

Playwright version mismatch

server version: v1.41
client version: v1.50

keep your local Playwright version in sync

You need to use version 1.41 of the client.


Status changed to Awaiting User Response railway[bot] 3 months ago


kc1TRIAL

3 months ago

does that mean, I should downgrade my local version of playwright to 1.41?


Status changed to Awaiting Railway Response railway[bot] 3 months ago


3 months ago

Yes exactly. You need to use version 1.41 of the client.


Status changed to Awaiting User Response railway[bot] 3 months ago


brody

Yes exactly. You need to use version 1.41 of the client.

kc1TRIAL

3 months ago

I downgraded and ran npm install - I am now getting {

"error": "locator.click: Timeout 30000ms exceeded.\nCall log:\n - waiting for getByText('Address')\n"

} in playwright. I'm pretty sure this is line 61 (

  await page.getByText("Address").click();

) in test-5.spec.ts. This makes me think that the login has failed. Screenshot https://www.dropbox.com/scl/fi/nwr77u2h6w1mkxr3av87o/wi-Crawford-014-0122-0010-1738112391-test.png?rlkey=eyfhzktw5wid9gw4md0sw25p6&st=wafqyzka&dl=0


Status changed to Awaiting Railway Response railway[bot] 3 months ago


3 months ago

I'm sorry but we cannot offer application-level support with your code here.

Going to mark this as solved since this means you where at least able to connect and use the template.


Status changed to Awaiting User Response railway[bot] 3 months ago