'FormatException: Invalid envelope in flutter Firebase Cloud Functions
I'm trying to call firebase functions from my flutter application for saving an image in firestore.
I am using the following code to upload my image data, But i'm receiving the error FormatException: Invalid envelope
_image = image.readAsBytes();
CloudFunctions.instance.call(
functionName: 'updateUserImg',
parameters: <String, dynamic>{
'img':_image,
},
);
My cloud function is not even getting called, seems like i'm sending the data in wrong format.
How I can fix this issue?
Thanks.
Solution 1:[1]
This issue generally comes when your device (Emulator or Mobile) is not having an internet connection.
Make sure your laptop/PC is connected with Wifi i.e. it is having an active internet connection.
Make sure your emulator/device has the Wifi and/or Mobile data ON.
Update: (24th May)
- Sometimes, if I switch to a different Wifi/Internet connection , then emulator shows this error. The solution to this is after switching to different Wifi/Internet connection, cold boot your emulator, when you start debugging.
Note: This option is shown when all emulators are closed and you click on Run --> Start Debugging on Visual Studio

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
