question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question]: How can i connect to browser running on a Moon cluster over secure websocket connection

See original GitHub issue

Your question

I am trying to connect to browser running on a Moon cluster over secure websocket connection as documented and i am getting the following exception "PlaywrightException: WebSocket error: unable to verify the first certificate" full trace:

Unhandled exception. Microsoft.Playwright.PlaywrightException: WebSocket error: unable to verify the first certificate
=========================== logs ===========================
<ws connecting> wss://moon.perci.dev.local/playwright/chromium/playwright-1.22.0
<ws error> [object Object]
<ws connect error> wss://moon.perci.dev.local/playwright/chromium/playwright-1.22.0 unable to verify the first certificate
<ws disconnected> wss://moon.perci.dev.local/playwright/chromium/playwright-1.22.0 code=1006 reason=
============================================================
   at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](String guid, String method, Object args) in /_/src/Playwright/Transport/Connection.cs:line 164
   at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal)
   at Microsoft.Playwright.Core.BrowserType.ConnectAsync(String wsEndpoint, BrowserTypeConnectOptions options) in /_/src/Playwright/Core/BrowserType.cs:line 150
   at TestMoon.TestMoon.Main() in C:\Users\69935\code\TestMoon\TestMoon\Program.cs:line 10
   at TestMoon.TestMoon.<Main>()

Process finished with exit code -532,462,766.

It is failing here : await using var browser = await playwright.Chromium.ConnectAsync("wss://moon.test.local/playwright/chromium/playwright-1.22.0");

The sertificates as stored in Local and User Certificate manager.

any suggestions?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rwollcommented, May 25, 2022

That error should be resolved by setting NODE_EXTRA_CA_CERTS to point to your cert.

Let me know if that works for you. In my repro, I was hitting the same error as you above, and setting NODE_EXTRA_CA_CERTS to point at my cert.pem resolved it.

I consider this suggestion a workaround since it leaks Node.js implementation details up to .NET (and in an ideal world we’d automatically pick it up from your OSes trust store assuming it’s been added).

0reactions
dimsamarascommented, May 25, 2022

@rwoll Thanks again! It works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Moon - A cross browser Selenium, Cypress, Playwright and ...
A Selenium, Cypress, Playwright and Puppeteer testing platform running in Kubernetes or Openshift clusters. Fully compatible with Selenium Webdriver ...
Read more >
How to secure your WebSocket connections - freeCodeCamp
#5: Use SSL over websockets​​ This is a no-brainer, but still needs to be said. Use wss:// instead of ws://. This adds a...
Read more >
The WebSocket API (WebSockets) - Web APIs - MDN Web Docs
desktop desktop Chrome Edge WebSocket Full support. Chrome4. Toggle history Full support. Edge12. Toggl... WebSocket() constructor Full support. Chrome4. Toggle history Full support. Edge12. Toggl...
Read more >
WebSockets and Node.js - testing WS and SockJS by building ...
Node.js can maintain many hundreds of WebSockets connections simultaneously. ... work with WS on the server and the browser's WebSocket API on the...
Read more >
26. WebSocket Support - Spring
On the browser side, applications can use the sockjs-client (version 1.0.x) that emulates the W3C WebSocket API and communicates with the server to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found