Я вызываю облачную функцию из iOS для удаления документов в Firestore. Функция вызывается и выполняется, но фактическое удаление никогда не происходит. Есть идеи, что я делаю не так?
Облачная функция:
const functions = require('firebase-functions');
const firebase_tools = require('firebase-tools');
exports.recursiveDelete = functions
.runWith({
timeoutSeconds: 540,
memory: '2GB'
})
.https.onCall((data, context) => {
const path = data.path;
console.log(
`User ${context.auth.uid} has requested to delete path ${path}`
);
return firebase_tools.firestore
.delete(path, {
project: process.env.GOOGLE_CLOUD_PROJECT,
recursive: true,
yes: true,
token: functions.config().fb.token
})
.then(() => {
return {
path: path
};
});
});
iOS
let deleteFunction = functions.httpsCallable("recursiveDelete")
deleteFunction.call(["path": docPath]) { (result, error) in
if let error = error as NSError? {
if error.domain == FunctionsErrorDomain {
let code = FunctionsErrorCode(rawValue: error.code)
let message = error.localizedDescription
let details = error.userInfo[FunctionsErrorDetailsKey]
print("\(code): \(message)\n\nDetails: \(details)")
}
} else {
print("Deletion was successful")
}
}
Вот вывод консоли из XCode:
Optional(__C.FIRFunctionsErrorCode): INTERNAL
Details: nil
Вот журнал выполнения: ![enter image description here](https://i.stack.imgur.com/G0cwg.png)