Edit: Three days into this issue, countless efforts to fix, and it randomly starts working again. This is more concerning. I confirmed no code changes, I no longer get the SSL errors, and the cloud functions are returning successfully.
I am using Flutter and Cloud Functions. Everything has worked perfectly and just randomly stopped working. I get these errors on iOS and Android
SSL handshake aborted: ssl=0xaf688b98: Failure in SSL library, usually a protocol error
error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER (third_party/openssl/boringssl/src/ssl/tls_record.cc:242 0xa86a9ce6:0x00000000)
Unhandled Exception: [firebase_functions/unavailable] UNAVAILABLE
If I change the HTTPS to HTTP, I don't get the error, but get a 302 error response instead.
cloud function:
var MESSAGING_SCOPE = 'https://www.googleapis.com/auth/firebase.messaging';
var SCOPES = [MESSAGING_SCOPE];
exports.getAccessToken = functions.https.onCall((data, context) => {
return new Promise(function(resolve, reject) {
var key = require("./file.json");
var jwtClient = new google.auth.JWT(
key.client_email,
null,
key.private_key,
SCOPES,
null
);
jwtClient.authorize(function(err, tokens) {
if (err) {
reject(err);
return;
}
resolve(tokens.access_token);
});
});
});
Flutter call:
HttpsCallable callable = FirebaseFunctions.instance.httpsCallable('getAccessToken');
return callable();
User contributions licensed under CC BY-SA 3.0