'Firebase function, error is not being catched
I have the following function in firebase:
exports.findUserInAuth = functions.https.onCall(async (data) => {
let value = data.value;
try {
return await admin.auth().getUserByEmail(value);
} catch (error) {
throw new functions.https.HttpsError(error.code, error.message);
}
});
In firebase functions logs I get:
findUserInAuth
Unhandled error Error: Unknown error code: auth/user-not-found. at new HttpsError (/workspace/node_modules/firebase-functions/lib/common/providers/https.js:69:19) at /workspace/index.js:22:13 at processTicksAndRejections (internal/process/task_queues.js:97:5)
As I understand I am catching the error correctly. On my client side I get the following error:
functions/internal
INTERNAL
According to documentation "If an error other than HttpsError is thrown from your functions, your client instead receives an error with the message INTERNAL and the code internal."
Any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
