gildas-lormeau / single-file-cli

CLI tool for saving a faithful copy of a complete web page in a single HTML file (based on SingleFile)
GNU Affero General Public License v3.0
602 stars 63 forks source link

Error: Execution context not found #80

Closed sissbruecker closed 5 months ago

sissbruecker commented 5 months ago

This error occurs quite often for several URLs that I've tried:

Execution context not found URL: https://www.youtube.com/watch?v=F47WWw5ztvk
Stack: Error: Execution context not found
    at onTopFrameNavigated (file:///Users/sascha/dev/sandbox/single-file-cli/lib/cdp-client.js:194:12)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async Connection.onFrameNavigated (file:///Users/sascha/dev/sandbox/single-file-cli/lib/cdp-client.js:181:7)

When it occurs, single-file can stall indefinitely and never exits. Doesn't happen consistently though.

It seems what these URLs have in common is that they redirect to some other URL after loading in the browser:

There's also this URL which doesn't have a redirect, but results in the same error:

sissbruecker commented 5 months ago

Related to this, I've opened https://github.com/gildas-lormeau/single-file-cli/pull/79, which would allow an application running single-file as a sub-process to properly terminate it after a timeout. Even if the above issues can be fixed, I'd still suggest to have something like that in place, so that other tools using single-file have some reliable way of shutting it down if it doesn't work for whatever reason.

gildas-lormeau commented 5 months ago

Thank you, this was actually a regression because retrieving the context ID of "singlefile" world is harder than I expected.

sissbruecker commented 5 months ago

Thanks, seems to work fine now 👍