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

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'substring' of undefined #6

Closed
StoneChenZephyr opened this issue Dec 7, 2019 · 6 comments

Comments

@StoneChenZephyr
Copy link

I always hit the following errors:

Transpiling TypeScript to JavaScript...
TSFILE: C:/StoneTemp/destreamer-dev/BrowserTests.js
TSFILE: C:/StoneTemp/destreamer-dev/destreamer.js
Using youtube-dl version 2019.11.22
Using ffmpeg version git-2019-11-26-59d264b Copyright (c) 2000-2019 the FFmpeg developers
Launching headless Chrome to perform the OpenID Connect dance...
Navigating to STS login page...
We are logged in. Sorry, i mean "you".
Got cookie. Consuming cookie...
Looking up AMS stream locator...
Video title is: Training
At this point Chrome's job is done, shutting it down...
Constructing HLS URL...
(node:5584) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'substring' of undefined
at rentVideoForLater (C:\StoneTemp\destreamer-dev\destreamer.js:83:27)
(node:5584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5584) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@upperdecker954
Copy link

I ran into the same issue, and it took me hours to figure out what the issue was.

Thanks to this page I simply added another argument '--no-sandbox' next to '--disable-dev-shm-usage'.

So, if anyone is like me...and has no idea what to do. I went into destreamer.ts, and scrolled down to the section between lines 47-52 (where it says "async function rentVideoForLater.....". From here, you simply add the argument I mentioned above.

async function rentVideoForLater() {
    console.log('Launching headless Chrome to perform the OpenID Connect dance...');
    const browser = await puppeteer.launch({
        // Switch to false if you need to login interactively
        headless: false,
        args: ['--disable-dev-shm-usage','--no-sandbox'],;
    });
    const page = await browser.newPage();
    console.log('Navigating to STS login page...');

Thank you so much for creating this...I just downloaded my first video from Stream, and it works perfectly. Beautiful job.

@snobu
Copy link
Owner

snobu commented Feb 14, 2020

Really happy you tracked this down and it now works for you. We should probably make --no-sandbox the default given the security concern it bring it's not really something to worry about for our use case. Let me try to run this with --no-sandbox on both Mac and Windows and if all goes well i'll make it the default.

@rajesh-s
Copy link

On windows, after adding this flag and building it again, the error/warning is still displayed but does not terminate running. Is this expected? I don't think the download is progressing. I can see the sandbox change reflect in the transpiled file as well.

@AndreaLonghitano
Copy link

It opens Chromium and it's impossible to download the video. How to solve this issue?

@snobu
Copy link
Owner

snobu commented Mar 21, 2020

@AndreaLonghitano Can you provide the logs please?

@snobu
Copy link
Owner

snobu commented Mar 30, 2020

Closing due to inactivity, please try out the new code (git pull and build), we improved a lot of the logic.

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

5 participants