Molunerfinn / PicGo

:rocket:A simple & beautiful tool for pictures uploading built by vue-cli-electron-builder
https://molunerfinn.com/PicGo/
MIT License
24.26k stars 2.24k forks source link

七牛云上传失败:Cannot read property 'body' of undefined #365

Closed wertycn closed 4 years ago

wertycn commented 4 years ago

问题类型

上传失败,日志提示:Cannot read property 'body' of undefined

PicGo的相关信息

PicGo v2.1.2 Windows7 七牛云

问题重现

在部分电脑上必定重现,已确认不是配置文件的问题,从可用的电脑上拷贝配置文件data.json覆盖不可用的电脑上的配置依然是不可用的

功能请求

在issue中查到了相关的问题,但是没有看到解决方法 https://github.com/Molunerfinn/PicGo/issues/131

wertycn commented 4 years ago

日志中的报错信息: -------Error Stack End------- 2019-12-03 13:32:55 [PicGo INFO] Before transform 2019-12-03 13:32:55 [PicGo INFO] Transforming... 2019-12-03 13:32:55 [PicGo INFO] Before upload 2019-12-03 13:32:55 [PicGo INFO] Uploading... 2019-12-03 13:32:56 [PicGo ERROR] TypeError: Cannot read property 'body' of undefined ------Error Stack Begin------ TypeError: Cannot read property 'body' of undefined at Object.handle (C:\Users\viruser.v-desktop\AppData\Local\Programs\PicGo\resources\app.asar\node_modules\picgo\dist\plugins\uploader\qiniu.js:65:51) at process._tickCallback (internal/process/next_tick.js:68:7) -------Error Stack End-------

Molunerfinn commented 4 years ago

剪贴板上传还是拖拽上传呢? 如果是PicGo的问题,那么其他图床能否上传?有没有可能是图片的问题,上传的格式是什么

Molunerfinn commented 4 years ago

另外配置文件覆盖之后需要重启PicGo才能生效,否则读取的依然是缓存里的配置

wertycn commented 4 years ago

有多次重启,选择文件,剪切板均不可以 选择文件时图片格式是jpg,使用的是win7系统图片目录下的示例图片

Molunerfinn commented 4 years ago

其他图床能上传么

wertycn commented 4 years ago

其他图床有试过腾讯云也不可以 不过暂时没有到别的电脑上验证过,配置里的区域设置不太确定是否正确,需要再验证一下

Molunerfinn commented 4 years ago

SM.MS不需要配置可以直接传,这个可以么

wertycn commented 4 years ago

可以的

wertycn commented 4 years ago

这是刚刚通过SM.MS上传的图片

Molunerfinn commented 4 years ago

很奇怪,我这边无法复现,七牛上传是正常的。如果其他图床能上传,理论上不是网络的问题。返回的报错信息不够,显示的是上传返回的结果是空的。

Molunerfinn commented 4 years ago

信息不够暂时无法解决,如果个别电脑的原因我也无法定位是什么问题。七牛上传相关的代码在这里: https://github.com/PicGo/PicGo-Core/blob/dev/src/plugins/uploader/qiniu.ts 有兴趣可以本地调试一下PicGo-Core看看是什么问题

wertycn commented 4 years ago

好的 我尝试一下

wertycn commented 4 years ago

const res = await ctx.Request.request(options); 已确认是执行到这一步时,程序抛出异常导致的失败,获取打印错误信息显示如下:

413 - "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<
html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n  <head>\n    <STYLE type=\"text/css\"><!--\n*\n{
\n\tmargin: 0px;\n}\n\nbody\n{\n\tfont-family: verdana, helvetica, sans-serif;\n\tfont-size: 13px;\n\tpadding: 0px;\n\tback
ground-color: #ffffff;\n\tcolor: #111111;\n}\n\na\n{\n\tbackground-color: inherit;\n\tcolor: #0000EE;\n}\n\na:hover\n{\n\tt
ext-decoration: none;\n}\n\np\n{\n\ttext-align: justify;\n\tmargin-bottom: 15px;\n\tline-height: 22px;\n}\n\nul\n{\n\tlist-
style: disc;\n\tpadding-left: 15px;\n\tmargin-bottom: 15px;\n}\n\nh3\n{\n\tfont-size: 20px;\n\tmargin-bottom: 30px;\n}\n\nh
4\n{\n\tfont-size: 13px;\n\tmargin-bottom: 5px;\n}\n\n#container\n{\n\tmargin: 0px 0px 0px 0px;\n}\n\n#header\n{\n\tbackgro
und-color: #660000;\n\tcolor: #fff;\n\tpadding: 10px 40px 10px 40px;\n}\n\n#headerok\n{\n\tbackground-color: #006600;\n\tco
lor: #fff;\n\tpadding: 10px 40px 10px 40px;\n}\n\n#header h1\n{\n\tfont-size: 30px;\n}\n\n#header h2\n{\n\tfont-size: 14px;
\n}\n\n#headerok h1\n{\n\tfont-size: 30px;\n}\n\n#headerok h2\n{\n\tfont-size: 14px;\n}\n\n#body\n{\n\tmargin: 10px 40px 10
px 40px;\n\tborder-bottom: solid 1px #DADADA;\n}\n\n#footer\n{\n\tmargin: 0px 40px 0px 40px;\n}\n\n#signature\n{\n        m
argin: 0px 40px 0px 40px;\n}\n\n\n#body p\n{\n}\n\n#errorwhat\n{\n\tpadding: 10px 0px;\n\tfont-size: 20px;\n\tborder-bottom
: solid 1px #DADADA;\n}\n\n\n.clearit\n{\n\tclear: both;\n\theight: 1px;\n}\n--></STYLE>\n\n    <meta http-equiv=\"Content-
Type\" content=\"text/html;charset=iso-8859-1\" />\n    <title>ERROR: The requested URL could not be retrieved</title>\n  <
/head>\n\n  <body>\n    <div id=\"container\">\n      <div id=\"header\">\n        <h1>ERROR</h1>\n        <h2>The requeste
d URL could not be retrieved</h2>\n      </div>\n\n      <div id=\"body\">\n        <div id=\"what\">\n          <p>While t
rying to retrieve the URL: <a href=\"http://upload.qiniu.com/putb64/-1/key/c291cmNlX2Jsb2cvYmcyMDA5MDQxNV8wMDJfemNvb2wuY29t
LmNuLmpwZw==\">http://upload.qiniu.com/putb64/-1/key/c291cmNlX2Jsb2cvYmcyMDA5MDQxNV8wMDJfemNvb2wuY29tLmNuLmpwZw==</a></p>\n
        </div>\n        <div id=\"errortitle\">\n          <p>The following error was encountered:</p>\n        </div>\n
     <div id=\"errorwhat\">\n          <p>The request or reply is too large.</p>\n        </div>\n        <div id=\"errorde
scription\">\n          <p>\n            If you are making a POST or PUT request, then your request body\n            (the
thing you are trying to upload) is too large.  If you are \n            making a GET request, then the reply body (what you
 are trying\n            to download) is too large.   These limits have been established\n            by the Internet Servi
ce Provider who operates this cache.  Please\n            contact them directly if you feel this is an error.\n          </
p>\n        </div>\n      </div>\n\n      <p>\n        <div id=\"footer\">Your cache administrator is <a href=\"mailto:cach
emaster\">cachemaster</a>.</div>\n        <div id=\"signature\">Generated Sat, 07 Dec 2019 11:41:34
 GMT by HexinFirewall (Lusca/LUSCA_HEAD-r14809).</div>\n      </p>\n\n    </div>\n  </body>\n</html>\n\n"
wertycn commented 4 years ago

看提示大概定位到原因了 似乎是我使用的电脑将发送到七牛上传api的post请求给拦截了

wertycn commented 4 years ago

The request or reply is too large.

If you are making a POST or PUT request, then your request body (the thing you are trying to upload) is too large. If you are making a GET request, then the reply body (what you are trying to download) is too large. These limits have been established by the Internet Service Provider who operates this cache. Please contact them directly if you feel this is an error.

发送请求后会跳转到一个网页,其中出现了这样的提示,post请求的大小超过了限制,不过为什么smms可以上传呢,很诡异

alexsuncn commented 2 years ago

请问有解决方法吗,我用的是Typora里的PicGo-Core(command line),也遇到了相同的问题

g1fts commented 1 year ago

我刚才也遇到了这个问题,在vs-picgo里的扩展设置里找到了答案,好像目前只有 z0 z1 z2 na0 ns0 才可以正常通过picgo-cli上传图片,我之前的是cn-ease-2每次都会弹这个错误,刚才新建了一个z0的区域,就没再报错了。希望能帮到之后遇到这个问题的伙计。 图片