w***@wicos.cn
w***@wicos.cn
  • 发布:2021-08-03 19:13
  • 更新:2021-09-28 19:37
  • 阅读:389

#插件讨论# 【 云函数formdata工具集 - DCloud_UNI_WYQ 】Cannot read property 'fileContent' of undefined

分类:uniCloud

使用环境:
开启HTTP URL访问并使用Postman 进行调试,调试选择POST协议,并使用form-data选择问价进行上传
问题
云函数提示Cannot read property 'filename' of undefined,以及Cannot read property 'fileContent' of undefined
推测
应该是提交的form-data不正确或者是什么原因,但是排查过后并没有发现错误,求解

2021-08-03 19:13 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

可以把上传地址改为https://httpbin.org/post看看返回的是什么,注意不要传太大的文件

  • 2***@qq.com

    麻烦看一下是什么原因,谢谢

    2021-08-06 12:46

2***@qq.com

2***@qq.com

我也是同样的问题,
返回

{  
    "success": false,  
    "error": {  
        "code": "\"FunctionBizError\"",  
        "message": "\":Cannot read property 'filename' of undefined\""  
    },  
    "data": null  
}

改为 https://httpbin.org/post


{  
    "args": {},  
    "data": "",  
    "files": {  
        "file": "# helloworld README\n\nThis is the README for your extension \"helloworld\". After writing up a brief description, we recommend including the following sections.\n\n## Features\n\nDescribe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.\n\nFor example if there is an image subfolder under your extension project workspace:\n\n\\!\\[feature X\\]\\(images/feature-x.png\\)\n\n> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.\n\n## Requirements\n\nIf you have any requirements or dependencies, add a section describing those and how to install and configure them.\n\n## Extension Settings\n\nInclude if your extension adds any VS Code settings through the `contributes.configuration` extension point.\n\nFor example:\n\nThis extension contributes the following settings:\n\n* `myExtension.enable`: enable/disable this extension\n* `myExtension.thing`: set to `blah` to do something\n\n## Known Issues\n\nCalling out known issues can help limit users opening duplicate issues against your extension.\n\n## Release Notes\n\nUsers appreciate release notes as you update your extension.\n\n### 1.0.0\n\nInitial release of ...\n\n### 1.0.1\n\nFixed issue #.\n\n### 1.1.0\n\nAdded features X, Y, and Z.\n\n-----------------------------------------------------------------------------------------------------------\n\n## Working with Markdown\n\n**Note:** You can author your README using Visual Studio Code.  Here are some useful editor keyboard shortcuts:\n\n* Split the editor (`Cmd+\\` on macOS or `Ctrl+\\` on Windows and Linux)\n* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)\n* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets\n\n### For more information\n\n* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)\n* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)\n\n**Enjoy!**\n"  
    },  
    "form": {},  
    "headers": {  
        "Accept": "*/*",  
        "Accept-Encoding": "gzip, deflate, br",  
        "Content-Length": "2267",  
        "Content-Type": "multipart/form-data; boundary=--------------------------279499248636712656722451",  
        "Host": "httpbin.org",  
        "Postman-Token": "0746fcb8-b1e0-492f-83fd-de475ebb5158",  
        "User-Agent": "PostmanRuntime/7.28.2",  
        "X-Amzn-Trace-Id": "Root=1-610cbdc7-09bdae29516e4322019110c6"  
    },  
    "json": null,  
    "origin": "42.80.217.62",  
    "url": "https://httpbin.org/post"  
}
1***@163.com

1***@163.com

请问解决了吗?

a***@126.com

a***@126.com

问题解决了吗

要回复问题请先登录注册