Reputation: 13803
I am currently migrating (creating new firebase project), from us-central 1 to asia-southeast2. I am using Firestore, Firebase storage and also cloud function.
I have no issue with Firebase Storage and Firestore, I can save the data as expected. because maybe both firestore and firebase storage are in the default location (asia-southeast2).
the problem is in the cloud function. asia-southeast2 doesn't have cloud function. so I deploy my callable cloud functions to asia-EAST2, like this
exports.callableModeratorAddEventToAlgolia = functions.region("asia-east2").https.onCall(async (data, context) => {
console.log("this log never called")
)}
and in Android, I call it like this
private val functions: FirebaseFunctions = FirebaseFunctions.getInstance()
fun addingEventToAlgolia(selectedEvent: Event): Task<String> {
// Create the arguments to the callable function.
val data = hashMapOf(
"eventID" to selectedEvent.eventID
)
return functions
.getHttpsCallable("callableModeratorAddEventToAlgolia")
.call(data)
.continueWith { task ->
val result = task.result?.data as String
result
}
}
I believe I have deployed the function correctly
the problem is, that function never called !
I am sure the code is executed in Android, but if I see the cloud function log, that callableModeratorAddEventToAlgolia
function is never triggered.
I have another function, which is a firestore trigger. and it works well, no issue even though I also deploy it in asia-east2. but I don't know why it doesn't work for callable cloud function
am I missing something ?
because previously, when all firestore, firebase storage and cloud function are all in us-central1. all is good. but when cloud function is not in the same region, I don't know why it is never called.
Upvotes: 0
Views: 340
Reputation: 13803
I think I find the solution, i have to instantiate the callable function object like this
val functions: FirebaseFunctions = FirebaseFunctions.getInstance("asia-east2")
Upvotes: 1