I have a huge function in my Flutter app, and every time I call it, it takes a long time to run. I want to rewrite it as a google cloud function and call it in my app in order to minimize the loading time.
Here is the way I call my backend function.
the title is a string value,
the arrayRanges is an array of arrays
try {
final result = FirebaseFunctions.instance
.httpsCallable('generatingAppointments')
.call(
{
'title': daysOfHelp[k].title,
'arrayRanges': ArrayOfAllTheDayRanges,
},
);
print("generatingAppointments No error");
} on FirebaseFunctionsException catch (error) {
print("generatingAppointments error");
print(error.code);
print(error.details);
print(error.message);
}
and after this my UI navigate to another page in my app immediately
and this is a simple code in the backend to test if I call the backend function correctly
exports.generatingAppointments = functions.https.onCall((data, context) => {
functions.logger.info("generatingAppointments Is running");
console.log('New Message written');
});
but the problem is I don’t see any of the print I wrote in the backend in my logs.
Note: I don’t need the result to return to my app, I will store it in the database and use it later.
EDIT:
when I removed ArrayOfAllTheDayRanges parameter the logs shows in my consol, but I don’t know why this parameter cause a problem
ArrayOfAllTheDayRanges is an array of arrays
2
Answers
I found out that my problem was in sending ArrayOfAllTheDayRanges which is an array of arrays (2-dimensional array). so when I remove it every thing went will
To be able to see the logs when you use console.log, you need to
require
the below dependenciesFor console.log
e.g
console.log(username)
For logger.log
e.g.
For functions.logger.log
e.g.