Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using cmd #117

Closed
emansih opened this issue May 3, 2020 · 9 comments
Closed

Crash when using cmd #117

emansih opened this issue May 3, 2020 · 9 comments

Comments

@emansih
Copy link

emansih commented May 3, 2020

Hi, I am using cmd to download videos.

When I run the following, the Chrome browser pops up for a brief second before crashing.

destreamer.cmd -i https://web.microsoftstream.com/video/xxxxxx

Some logs:

Using ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers

.token_cache not found.

Launching headless Chrome to perform the OpenID Connect dance...
Navigating to login page...
Error: Page crashed!
    at Page._onTargetCrashed (C:\Users\User\destreamer\node_modules\puppeteer\lib\Page.js:213:24)
    at CDPSession.<anonymous> (C:\Users\User\destreamer\node_modules\puppeteer\lib\Page.js:122:56)
    at CDPSession.emit (events.js:315:20)
    at CDPSession._onMessage (C:\Users\User\destreamer\node_modules\puppeteer\lib\Connection.js:200:12)
    at Connection._onMessage (C:\Users\User\destreamer\node_modules\puppeteer\lib\Connection.js:112:17)
    at WebSocket.<anonymous> (C:\Users\User\destreamer\node_modules\puppeteer\lib\WebSocketTransport.js:44:24)
    at WebSocket.onMessage (C:\Users\User\destreamer\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (C:\Users\User\destreamer\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:315:20)


Unhandled error!
Timeout or fatal error, please check your downloads directory and try again

There is nothing in my videos directory.

npm version: 6.14.4
node version: v14.0.0
destreamer version: 94b6da7
Windows 10 build 18363

Thanks for any help!

@snobu
Copy link
Owner

snobu commented May 3, 2020

For some reason the Chromium build that puppeteer pulls down from npm crashes on your system. Instead of debugging that (which may prove difficult) you could try plugging in your own browser (Chrome or the Chromium-based Microsoft Edge should both work).

See #32 (comment) for details.

@snobu snobu closed this as completed May 3, 2020
@emansih
Copy link
Author

emansih commented May 3, 2020

still crashes with the same message even after changing my browser. i have tried powershell and cmd

@snobu snobu reopened this May 4, 2020
@snobu
Copy link
Owner

snobu commented May 4, 2020

Really wish i could help here, but since i'm unable to reproduce i don't really know where to begin. Can you run npm run test successfully?

Try adding --disable-gpu and --no-sandbox to puppeteer, maybe it helps. Don't forget to npm run build after.
https://github.com/snobu/destreamer/blob/master/src/destreamer.ts#L57

['arg1', 'arg2', ...]

Also, if you're running in a VM make sure it has plenty of memory, Chromium doesn't joke around. If you're running in a Docker container, don't. I've also noticed you're on Node 14. I have not tested on 14. Try with latest stable 13.x. nvm is very handy for switching between versions.

If nothing helps, page.on('error'... can be used to (maybe) get more info about what breaks.

Somewhere here (after that line) -

page.on('error', err => {
    console.error('Page crashed: ', err);
});

@emansih
Copy link
Author

emansih commented May 4, 2020

interesting.... adding the --no-sandbox argument works now! Thanks for the help!

@emansih emansih closed this as completed May 4, 2020
@snobu snobu reopened this May 4, 2020
@snobu
Copy link
Owner

snobu commented May 4, 2020

Alright, i'm going to make that the default. @kylon, @lukaarma, any immediate downside to that? I don't see any.

@emansih
Copy link
Author

emansih commented May 4, 2020

Downside is breaking chrome's security model since there is no sandbox

@snobu
Copy link
Owner

snobu commented May 4, 2020

Should be fine, both the app and the browser window are controlled by the user and the execution time is very limited, i don't see a viable attack vector.

Alternatively, we could catch that page error and try to launch puppeteer again with --no-sandbox. Happy to accept a PR for that.

@lukaarma
Copy link
Collaborator

lukaarma commented May 6, 2020

It should be fine since we check that we are not admin/root and we visit only Microsoft pages...so I think this can be a fix but if we can found another fix down the line i would prefer to re enable sandboxing

@snobu
Copy link
Owner

snobu commented May 18, 2020

Destreamer now launches Chromium with --no-sandbox because YOLO.

@snobu snobu closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants