megerr when launching chrome in headlless mode :
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
I'm writing a script node express,
when express receive a http request, the script node launch new chrome instance in headless-mode using lib chrome_launcher , do some stuff, and kill the istance.
the remote server is a VPS with ubuntu16.04.
to launch the webserver I connect via ssh with VPS:
$ node app_ws.js &
If the ssh connection is alive all works fine and node script can launch chrome regularly.
Instead, when I close the terminal and break-down the ssh connection (and the user session terminates) then starts the badly:
in the first request chrome is launched, OK,
from the second request onwards script cant launch chrome, the message error is:
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
code snippets
//launch chrome in hadless mode using npm lib chrome_launcher (https://github.com/cyrus-and/chrome-remote-interface)
const chrome = await chromeLauncher.launch({
"chromeFlags": [ '--disable-gpu', '--headless' ]
});
//Kill Chrome
chrome.kill()
chrome.kill() return a promise but dont catch any error
thanks from now for help