[Android] Cloud Functions returning arrays are not correctly parsed
jpoag opened this issue · 4 comments
Reproduction source code: #31
Operating system: Android
Operating system version: minSDK: 14,15,16 buildSDK:26 & 27
C++ SDK: 5.2.0 & 5.1.1
Dependencies: implementation 'com.google.firebase:firebase-functions:16.1.0'
What steps will reproduce the problem:
- Using
firebase/functions
, call a Cloud function that returns an array (filled) as the value of thedata
return... E.g:
exports.echoBody = functions.https.onRequest((request, response) => {
response.status(200);
response.json({ data : ['this', 'is' 1, 'test'] } );
});
- When the future completes, check the
result->data()
variant. It iskNullType
What is the expected result?
Using the iOS SDK, the result is the array.
What happens instead of that?
Null is returned. I suspect that the parsing of array/vectors are not implemented or are interpreted differently.
Please provide any other information below, and attach a screenshot if possible.
I stumbled across this issue implementing server side receipt checking for IAB. I use a 3rd party source that returns the validated receipt as an array of objects, each object representing a SKU (+State). For iOS, this works perfectly. When implementing the same calls for Android, I get a null response. I debugged both sides of the app, including turning on logging for my Cloud functions to log the return value. I even checked using Postman: the server response is valid.
Next, I forked quickstart-cpp
, cloned the database
example and re-purposed it to test Cloud Functions (See #31). The tests all run correctly (even with the Int64/Double issue) with the exception of Arrays/Vectors returning null. (See functions/testapp/src/common_main.cc )
Per Firebase Support, I have changed the echoBody
on the server from onRequest
to onCall
655401d .
The issue still persists. I have caught the following warning in LogCat:
W/firebase: Class java.util.ArrayList cannot be converted to Variant, leaving empty.
I maintain that this is a Android-specific, C++ error.
Hi jpoag, we've identified the bug and have a fix in the works. The fix should be rolled out in an update in the near future.
Fixed in 5.3.0:
https://firebase.google.com/support/release-notes/cpp-relnotes