Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alipay.open.file.upload上传超出限制 #130

Closed
gwwnha opened this issue Jun 4, 2024 · 4 comments · Fixed by #134
Closed

alipay.open.file.upload上传超出限制 #130

gwwnha opened this issue Jun 4, 2024 · 4 comments · Fixed by #134
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@gwwnha
Copy link

gwwnha commented Jun 4, 2024

调用alipaySdk.exec('alipay.open.file.upload', ....),没有经过nginx。

待上传文件大概150M左右,方法报错如下:
AlipayRequestError: HTTP 请求错误, status: 413

\r\n' +
'<html>\r\n' +
'<head><title>413 Request Entity Too Large</title></head>\r\n' +
'<body bgcolor="white">\r\n' +
'<h1>413 Request Entity Too Large</h1>\r\n' +
'<P>The requested resource does not allow request data with the requested method or the amount of data provided in the request exceeds the capacity limit. Sorry for the inconvenience.<br/>\r\n' +
'Please report this message and include the following information to us.<br/>\r\n' +
'Thank you very much!</p>\r\n' +
'<table>\r\n' +
'<tr>\r\n' +
'<td>URL:</td>\r\n' +
'<td>https://openapi.alipay.com:3012/gateway.do?method=alipay.open.file.upload&amp;app_id=(删除)&amp;charset=utf-8&amp;version=1.0&amp;sign_type=RSA2&amp;timestamp=2024-06-04+18%3A52%3A05&amp;sign=p3xs9ie2ipq9dGXin%2Fq6mA7Xkbq3pTG15y8C%2BmX%2FpLj2Uly5uENCsVNDE5K036829xIRLA4aa2101c6Ee9YG5xLKOqlPav15dfpEelrc3Tzotr3hQ%2FQ7S461LXaOt1VB8WcXDsEr5MqAx6hFUcTQDwE0O7NaeUpTCVVWYIWK57bOpy8BP317DKrdUVQBRSbe2XsRrw7YXrCFnw2OuJpBPaOahms9nWKxaP6oTBcwE5TsRRpb1fgdVzM2BGv0aKexw8pbzySpd8R6DZ1HbIC6MDZfJz44WO4wtcih9kI2XuFVIa9%2BYecHEGgY%2BbW3Qzt07GVH8G5ZEq%2BwLnWvtMf1Dg%3D%3D</td>\r\n' +
'</tr>\r\n' +
'<tr>\r\n' +
'<td>Server:</td>\r\n' +
'<td>spanner-internet-cz50b-26742.sa127</td>\r\n' +
'</tr>\r\n' +
'<tr>\r\n' +
'<td>Date:</td>\r\n' +
'<td>2024/06/04 18:52:11</td>\r\n' +
'</tr>\r\n' +
'</table>\r\n' +
'<hr/>Powered by Tengine/2.1.0</body>\r\n' +
'</html>\r\n
@fengmk2 fengmk2 added the question Further information is requested label Jun 4, 2024
@fengmk2
Copy link
Member

fengmk2 commented Jun 5, 2024

请问你上传的文件名后缀是那种类型的?

@fengmk2
Copy link
Member

fengmk2 commented Jun 5, 2024

https://github.com/alipay/alipay-sdk-nodejs-all?tab=readme-ov-file#%E4%BD%BF%E7%94%A8-alipayformdata-%E8%A1%A8%E5%8D%95%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6 @gwwnha 可以试试最新版本,走 curl 接口上传,我测试了一下支付宝 openapi v3 协议是不会出现这个问题的。

@fengmk2
Copy link
Member

fengmk2 commented Jun 5, 2024

定位到了问题,需要 sdk 设置 content-length 在请求 header 里面。这个会在 alipay-sdk@4 版本修复。

@fengmk2 fengmk2 added the bug Something isn't working label Jun 5, 2024
@fengmk2 fengmk2 self-assigned this Jun 5, 2024
fengmk2 added a commit that referenced this issue Jun 5, 2024
fengmk2 added a commit that referenced this issue Jun 6, 2024
避开 OpenAPI 接入层的 chunk 数量限制

基于 node-modules/formstream#26 实现

closes #130
@fengmk2
Copy link
Member

fengmk2 commented Jun 6, 2024

#134 会修复此问题

fengmk2 added a commit that referenced this issue Jun 6, 2024
fix: 设置文件上传分片 chunk 最小为 2MB, 避开 OpenAPI 接入层的 chunk 数量限制
基于 node-modules/formstream#26 实现

closes #130
closes #135
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants