I'm getting `Couldn't connect...` error message, diving deeper tells me the error is `certificate has expired`
Opened this issue · 0 comments
Without changing anything on my end, I'm running my code again after a few months and getting Couldn't connect to ffbinaries.com API. Check your Internet connection.
I looked into what's reporting this, it's this line:
ffbinaries-node/ffbinaries-lib.js
Line 166 in edb47e9
Logging the err
variable from there gives me:
"Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1331:34)
at TLSSocket.emit (events.js:210:5)
at TLSSocket._finishInit (_tls_wrap.js:804:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:618:12)"
Which doesn't make any sense to me since I can access the url fine from Chrome/Postman. I'm getting the latest version of ffmpeg and ffprobe, and I've checked the url, it's correct. The url it's requesting is "https://ffbinaries.com/api/v1/latest"
Maybe the redirect has something to do with it? Anyway, I replaced the request function with fetch and it does work without issue, so maybe you could fix it that way.
This is what I cooked up real quick:
fetch(API_URL + url).then(r => r.text().then(body => {
var parsed;
try {
parsed = JSON.parse(body.toString());
} catch (e) {
return callback(errorMsgs.parsingVersionData);
}
RUNTIME_CACHE[version] = parsed;
return callback(null, parsed);
}).catch(e => console.warn('json err', e))
).catch(e => console.warn("fetch err", e))
No proper error checks here though.
I'm using node 16.20.0