hezzze/strapi-provider-upload-oss

Upload failed

Closed this issue · 1 comments

Hi hezzze,

I want to know what's the recommended policy configuration for the OSS user/role?

I setup the plugin but it can not upload file somehow. No idea if it was due to policy configuration, but even after I grant the AliyunOSSFullAccess to the user, I still can not upload any files...


stack: Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
    at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17)
>>>>>>> upload oss <<<<<<<
Error [ResponseError]: read ECONNRESET, PUT https://my-app.cn-chengdu.aliyuncs.com/dev/uploads/small__cb97850d1a.jpeg -1 (connected: true, keepalive socket: false, agent status: {"createSocketCount":10,"createSocketErrorCount":0,"closeSocketCount":9,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{"my-app.cn-chengdu.aliyuncs.com:443:::::::::::::::::::::":1},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0)
headers: {}
    at Client.requestError (/Users/my-name/workspace/my-app-api/node_modules/ali-oss/lib/client.js:329:13)
    at Client.request (/Users/my-name/workspace/my-app-api/node_modules/ali-oss/lib/client.js:216:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async proto.request (/Users/my-name/workspace/my-app-api/node_modules/ali-oss/lib/client.js:194:12)
    at async Client.putStream (/Users/my-name/workspace/my-app-api/node_modules/ali-oss/lib/object.js:152:18)
    at async Client.put (/Users/my-name/workspace/my-app-api/node_modules/ali-oss/lib/object.js:88:12) {
  status: -1,
  code: 'ResponseError'
}
[2023-10-11 21:37:15.046] error: read ECONNRESET, PUT https://my-app.cn-chengdu.aliyuncs.com/dev/uploads/_cb97850d1a.jpeg -1 (connected: true, keepalive socket: false, agent status: {"createSocketCount":6,"createSocketErrorCount":0,"closeSocketCount":5,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{"my-app.cn-chengdu.aliyuncs.com:443:::::::::::::::::::::":1},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0)
headers: {}
ResponseError: read ECONNRESET, PUT https://my-app.cn-chengdu.aliyuncs.com/dev/uploads/_cb97850d1a.jpeg -1 (connected: true, keepalive socket: false, agent status: {"createSocketCount":6,"createSocketErrorCount":0,"closeSocketCount":5,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{"my-app.cn-chengdu.aliyuncs.com:443:::::::::::::::::::::":1},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0)
headers: {}
    at Client.requestError (/Users/leidong/workspace/neighborhood-api/node_modules/ali-oss/lib/client.js:329:13)
    at Client.request (/Users/leidong/workspace/neighborhood-api/node_modules/ali-oss/lib/client.js:216:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async proto.request (/Users/leidong/workspace/neighborhood-api/node_modules/ali-oss/lib/client.js:194:12)
    at async Client.putStream (/Users/leidong/workspace/neighborhood-api/node_modules/ali-oss/lib/object.js:152:18)
    at async Client.put (/Users/leidong/workspace/neighborhood-api/node_modules/ali-oss/lib/object.js:88:12)
http-errors deprecated non-error status code; use only 4xx or 5xx status codes node_modules/@strapi/strapi/lib/services/errors.js:64:21

Never mind, issue resolved.

It realized it was due to I put the incorrect region id after reading your REAME again...

It should be oss-cn-chengdu rather than cn-chengdu