Closed xuhpppp closed 2 months ago
I'm also seeing this same issue. Can't find a good way to close the process after the stream has finished writing.
Facing same issue. @SamuelScheit Please have a look on it.
As a workaround until I find a solution you can prevent node from crashing on errors via
process.on('uncaughtException', function (err) {
console.error(err);
});
The error is probably caused because the stream is not properly closed, I'll investigate
@SamuelScheit Hey, any news on this ?
The workaround that worked for me.
The most critical line is:
await page.evaluate((index) => window.STOP_RECORDING?.(index), i);
since the extension page maintains a web socket connection and recorders that try to access a closed browser.await stream.destroy();
await new Promise((resolve) => {
file.close(async () => {
const pages = await browser.pages();
for (let i = 0; i < pages.length; i++) {
const page = pages[i];
// @ts-expect-error - get STOP_RECORDING from extension page.
await page.evaluate((index) => window.STOP_RECORDING?.(index), i);
await page.close();
}
await browser.close();
wss.close(() => {
resolve(undefined);
});
});
});
cc. @SamuelScheit @saif-o99 @dcprime @dhavalCode @xuhpppp
@SamuelScheit Thanks for your awesome library. Did you ever find a fix for this?
Hi everyone, i'm using Puppeteer-stream for some recording tasks, i followed the example code on main page, everything worked fine except the case that after recording, i want to close the browser by using browser.close():
but the console returned error:
then my application stoped. I'm running the application on Ubuntu 20.04, NodeJS 18.16.0 and Puppeteer-stream 3.0.7 Have someone ever met this issue and had the fixing way for it? Thanks for reading my issue, have a good day.