Rank 4: Virtual Machine
^```
code works fine when ran independently on vscode, but I get this error when I deploy and send request from client side
I need an assistance, cause I'm sure am getting something wrong without knowing yet.Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 4: Virtual Machine
^```
code works fine when ran independently on vscode, but I get this error when I deploy and send request from client side
I need an assistance, cause I'm sure am getting something wrong without knowing yet.Rank 4: Virtual Machine
cloud function response error
This usually happened when the payload data is not a valid JSON.
Can you print the payload data and make sure it's a valid JSON with all the double quotes, trailing comma, etc.
Rank 4: Virtual Machine
on the cloud function or Flutter code?
besides I appreciate you for reaching out @Binyamin
can't take that for granted
In your cloud function code.
Actually where's the error coming from?
The App?
Can you share the code of how you're running the function?
Rank 4: Virtual Machine
How do I make it valid then?
Rank 4: Virtual Machine
{numberToProcess: 62626262666 , userMail: @mail.com , userID: 649f4aa7ab7ysy4b89ba0bd , totalServiceCharge: 200 , serciceTypeAndService: 9MOBILE CG , serviceQuantity: 500MB , walletBalanceDocumentID: 12222222222, networkID: 3 , planID: 329 , serviceName: Mobile Data, customerAmount: 200 , distributorName: none, meterTypeWithID: none, cableNameWithID: none, cablePlanWithID: none}
what was printed on Flutter before sending
What is your createExecution looks like?
Rank 4: Virtual Machine
functionId: 'automate_service_sender', data: jsonEncode(sendData));
exec.then((response) { final decoded = jsonDecode(response.response);
if (kDebugMode) { print("is: ${decoded.toString()}"); } });Okay this part looks just fine.
Can you share how you parse the payload in the server?
Rank 4: Virtual Machine
dataFromClient = jsonDecode(req.payload);
Rank 4: Virtual Machine
And dataFromClient was declared as dynamic
Okay, and what do you see when you're printing the payload
print(req.payload);Rank 4: Virtual Machine
If I try to print that dart will say it does not understand the Appwrite variables and all of that
Rank 4: Virtual Machine
So I do comment them usually
upright?
Meaning?
Rank 4: Virtual Machine
When debugging from vscode
Rank 4: Virtual Machine
Appwrite I meant
@Binyamin
It was a voice to text, was walking on the road
Comment what?
req.payload should be string
Can you print it, or you getting error trying to do so?
Rank 4: Virtual Machine
Beginning from initialization of appwrite gives an error and when I change function name to main instead of start
You can't change the name
Make sure the function file structure it's like in the starter
https://github.com/appwrite/functions-starter/blob/main/dart-2.17/lib/main.dart