obsidianmd / obsidian-api

Type definitions for the latest Obsidian API.
https://docs.obsidian.md
MIT License
1.65k stars 192 forks source link

Bug: requestUrl throws net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED #137

Closed adamluckdev closed 4 months ago

adamluckdev commented 8 months ago

Some users of ReadItLater plugin reported issues with fetching websites with same error net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED. This error occurs only on desktop apps on all platforms and since it happens in Electron layer I'm unable to debug it properly.

We use requestUrl function and request is sent as basic GET.

https://github.com/DominikPieper/obsidian-ReadItLater/blob/210d016b1038783e4f44615c4b1f0e24c9a2f19f/src/parsers/WebsiteParser.ts#L33

I found only limited amount of resources about this error. Some blames the server configuration other suggests to test if certificate-error or select-client-certificate events are emitted.

Affected URLs:

lishid commented 8 months ago

This sounds like it's coming from Chromium within Electron, and is probably related to some weird SSL configuration on the servers, or root certs on the user's machine. Unfortunately this isn't something I can debug and I couldn't find much about it in search results either.

andytinkham commented 5 months ago

I'm getting the same error. Even just going to the Obsidian Developer tools console and running

await requestUrl({url: `https://api.first.org/data/v1/epss?cve=CVE-2019-0708`});

throws

Uncaught Error: net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED
    at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/browser_init:2:49935)
    at SimpleURLLoaderWrapper.emit (node:events:513:28)

This occurs both on my work MacBook Pro and my home MacBook Pro, which seems to indicate that it's server-side or in a default root cert.

I can run curl https://api.first.org/data/v1/epss?cve=CVE-2019-0708 successfully from a terminal which suggests that it's something not machine-wide for my machines.

Is there anything I can share that might make this easier to figure out what's going on?

lishid commented 4 months ago

requestUrl on desktop/Electron uses net.request (https://www.electronjs.org/docs/latest/api/net#netrequestoptions). Unfortunately that means this kind of errors are not something we know how to fix.

I suggest looking to see if you can use Electron Fiddle to reproduce the same issue and submit a bug report to Electron.

Will close the issue for now - but feel free to link to it and continue discussions.