I'm new to Android development, and am encountering a problem while working with Google Cloud functions:
{
"userId":"firestore_generated_user_id",
"telephone": "0101010101",
"email": "[email protected]",
"addresses" : [{
"country": "Brasil",
"city": "San Hose",
"street": "Rose Ave",
"number": "12",
"еntrance" : "1",
"floor": "2",
"apartment": "3",
"disabled" : false
}]
}
I created a class for "addresses", and then:
val addressForFirestoreFunction = Addresse("15", "San Hose", "Brasil", false, "5", "10", "Rose Ave", "")
after that i put my addressForFirestoreFunction to arraylist :
var adresses = ArrayList<Addresse>()
adresses.add(addressForFirestoreFunction)
After that I create a map:
val adressForFunction = mapOf(
"userId" to "firestore_generated_user_id",
"telephone" to "0877080792",
"email" to "[email protected]",
"addresses" to adresses
)
Then finally trigger the function:
functions
.getHttpsCallable("addAddress")
.call(adressForFunction)
.continueWith { task ->
val result = task.result?.data as String
Log.e("tag",result.toString())
result
}
In logs of firestore functions - nothing happens, absolutely. When i trigger the function with empty:
.call()
In the logs I can see that function was invoked, but shortly after that it crashes. When making the request in Postman everything works well.
I'm really out of ideas here, and would appreciate any suggestions from the community in solving this problem. Thank you.
question from:
https://stackoverflow.com/questions/65845071/problem-with-triggering-firestore-function-from-mobile-app-client