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
647 stars 63 forks source link

--error-file : getting always error reference "Users/gildas/Desktop/Dev/project-single-file/single-file-cli/" #104

Closed emp-00 closed 4 months ago

emp-00 commented 4 months ago

Dear Team, I'm using single-file.exe (Win11) with this command line option: -error-file="errorlogfile.txt"

Symptom: WIth every call the errorlogfile.txt fills up and it always shows the below error obviously pointing to the developer's files on his local directory structure. Looks like this path is hardcoded in single-file.exe ? In my eyes this is a bug, thanks for looking into this :-)

URL: file:///Users/gildas/Desktop/Dev/project-single-file/single-file-cli/single-file-cli-api.js
Stack: Error: Unreachable URL: file:///Users/gildas/Desktop/Dev/project-single-file/single-file-cli/single-file-cli-api.js
    at Connection.onFrameNavigated (file:///Users/gildas/Desktop/Dev/project-single-file/single-file-cli/lib/cdp-client.js:306:15)
    at innerInvokeEventListeners (ext:deno_web/02_event.js:754:7)
    at invokeEventListeners (ext:deno_web/02_event.js:801:5)
    at dispatch (ext:deno_web/02_event.js:658:9)
    at Connection.dispatchEvent (ext:deno_web/02_event.js:1043:12)
    at Connection.#onMessage (https://jsr.io/@simple-cdp/simple-cdp/1.8.5/mod.js:205:18)
    at WebSocket.<anonymous> (https://jsr.io/@simple-cdp/simple-cdp/1.8.5/mod.js:168:83)
    at innerInvokeEventListeners (ext:deno_web/02_event.js:754:7)
    at invokeEventListeners (ext:deno_web/02_event.js:801:5)
    at dispatch (ext:deno_web/02_event.js:658:9)
gildas-lormeau commented 4 months ago

The executable file is compiled with Deno. It looks like it includes the full paths to the source code when displaying a stack trace. That's why you see the folder name of the project on my machine. It's not really a problem for me. Just to be sure, you would like to see the same error message but with file:///Users/gildas/Desktop/Dev/project-single-file/occurrences removed from the stack trace? The only thing that I did not expect though is the first line URL: file:///Users/gildas/Desktop/Dev/project-single-file/single-file-cli/single-file-cli-api.js. What command did you type to get this error?

emp-00 commented 4 months ago

Yes, I would like to get this error-message eliminated because I don't believe it's a relevant error (I would call it a bug, simply because this path does not exist on my machine and I have nothing to do against it) - and to make it clear again, I get this error with every single call of single-file.exe ... So my error-log is overflowing ;-)

Here's my call for your reference: `single-file.exe --browser-executable-path="C:\Thorium\bin\thorium.exe" --browser-arg="--user-data-dir=C:\Thorium\userdata" --browser-width=640 --browser-height=1200 --browser-load-max-time=30000 --block-fonts --compress-HTML=false --error-file="errorlogfile.txt" --filename-conflict-action=overwrite --urls-file=URL-list.txt --filename-template="Download{url-pathname-flat}{url-search}.html"'

gildas-lormeau commented 4 months ago

Thank you, I can add an option to remove stack traces. They are sometimes useful to identify the cause of a bug in single-file. Out of curiosity, do you know the URL which caused the issue in URL-list.txt? This is what is intriguing me.

emp-00 commented 4 months ago

The url "causing" this error is similar to this: https://enlighten.enphaseenergy.com/web/5000000/today/graph/hours

Unfortunately, you probably cannot reproduce the error, because we're talking about a PV metrics status report system. You need to login with credentials to access (mine or other owner's - ID is 5XXXXXX) website that I'm downloading. The page uses javascript and other techniques - and that's exactly why I use single-file, because it is powered by state-of-the art chromium browsers that can handle this page. Using curl or wget fails completely, but single-file does the job incl. login via saved cookies.

Why exactly do you think the error disclosing your development path structure is "caused" by the webpage displayed in the chromium browser?

Long story short, I like your proposal adding a command-line option to switch off thise "stack traces". :-)

Thanks for your efforts and explicit thanks for sharing this tool with the community. Much appreciated!

gildas-lormeau commented 4 months ago

The stack traces are now disabled by default in the version 2.0.47 I've just published.

emp-00 commented 4 months ago

@gildas-lormeau : Thank you! Confirmed - 2.0.57 throws no more of such errors -> this issue can be closed.

gildas-lormeau commented 4 months ago

Thank you for the feedback @emp-00!