我正在尝试从我的 flutter 应用程序中调用 firebase 函数以在 firestore 中保存图像。
我正在使用以下代码上传我的图像数据,但我收到错误 FormatException: Invalid envelope
_image = image.readAsBytes();
CloudFunctions.instance.call(
functionName: 'updateUserImg',
parameters: <String, dynamic>{
'img':_image,
},
);
Run Code Online (Sandbox Code Playgroud)
我的云功能甚至没有被调用,似乎我以错误的格式发送数据。
我该如何解决这个问题?
谢谢。
当您的请求超时时,就会发生这种情况。确保您有有效的互联网连接。如果通过 LAN 使用模拟器,请确保按如下方式指定来源。
cloudFunctions.useFunctionsEmulator(
origin: "http://192.168.31.107:5001");
Run Code Online (Sandbox Code Playgroud)
代替
_cloudFunctions.useFunctionsEmulator(
origin: "192.168.31.107:5001");
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
890 次 |
最近记录: |