KevinBytesTheDust/CVAmp

Error: spawn UNKNOWN" when launching Chrome instances in Playwright

Closed this issue · 3 comments

Hello,

I have encountered a problem when launching Chrome instances using Playwright in my application. The instances are configured with certain parameters, including proxy settings and user agent details. However, when trying to start these instances, I consistently receive the following error: playwright._impl._api_types.Error: spawn UNKNOWN.

Here's the traceback for the error:

Traceback (most recent call last):
  File "ctvbot\instance.py", line 81, in start
  File "ctvbot\instance.py", line 132, in spawn_page
  File "playwright\sync_api\_generated.py", line 14733, in launch
  File "playwright\_impl\_sync_base.py", line 109, in _sync
  File "playwright\_impl\_browser_type.py", line 95, in launch
  File "playwright\_impl\_connection.py", line 61, in send
  File "playwright\_impl\_connection.py", line 482, in wrap_api_call
  File "playwright\_impl\_connection.py", line 97, in inner_send
playwright._impl._api_types.Error: spawn UNKNOWN

The script is being run on a Windows 11 Pro system, and I'm trying to start headless Chrome instances with different proxies and user agent settings. I've tried different proxies and user agents but consistently encounter the same error. It seems that the error occurs when the system tries to spawn a new Chrome instance, but I'm not sure why this is happening.

I've followed all the installation steps for Playwright and its browser binaries. Could there be a problem with the way I'm configuring my Chrome instances, or is this a potential issue with Playwright itself? Any help in resolving this issue would be appreciated.

Thank you!

Hmmmm difficult. I think this is a problem with playwright. Could you try with chromium, i.e. comment out this line:
https://github.com/jlplenio/crude-twitch-viewer-bot/blob/8380c49fdeba680c202b124c789c72c7d0abaa03/ctvbot/instance.py#L135C1-L135C30

And try a different browser by changing https://github.com/jlplenio/crude-twitch-viewer-bot/blob/8380c49fdeba680c202b124c789c72c7d0abaa03/ctvbot/instance.py#L132 with e.g. playwright.firefox.launch()

In general, I would recommend you try playwright isolated in a small custom python script. And return to the bot once it works.

And does the executable work from https://github.com/jlplenio/crude-twitch-viewer-bot/releases/latest?

Hi @jlplenio ,

I wanted to provide an update on this issue. I've managed to resolve it by switching from using Google Chrome to Mozilla Firefox in the Playwright configuration. Here's how I modified the relevant part of the script:

self.playwright = sync_playwright().start()

self.browser = self.playwright.firefox.launch(
    proxy=proxy_dict,
    headless=self.headless,
    channel="firefox",
    args=[
        "--window-position={},{}".format(self.location_info["x"], self.location_info["y"]),
        "--mute-audio",
    ],
)

This change seems to have resolved the spawn UNKNOWN error I was facing with Chrome. The script now successfully launches a Firefox instance via Playwright.

I'd like to thank the developers for creating and maintaining this project. Your work is greatly appreciated.

I'm now closing this issue as it has been resolved.

Best Regards,
Nes

Interesting. Can you confirm that everything is works as expected. Restarts, fresh, kill, screenshot, green status boxes etc.
I was afraid to switch to another browser because I kept seeing in my tests that Twitch behaves differently depending on the browser (layout, cookies, local storage).

And thank you for coming back and presenting your solution. Kudos @Nesonica