You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
这段代码中的 secretId 给错时报错为:
(node:10516) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.stat (fs.js:1057:10)
at C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\advance.js:828:12
at Object.each (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\util.js:248:13)
at COS.uploadFiles (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\advance.js:827:10)
at COS.uploadFiles (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\util.js:461:29)
at internal/util.js:297:30
at new Promise ()
at COS. (internal/util.js:296:12)
...
实际的错误是:
CloudBaseError: SIGN_PARAM_INVALID: secret key not exist
也就是 sdk 在用错误的 secretId 请求云 API 时返回的错误。
这层错误被 sdk 掩盖掉了,导致实际报出来的错误完全看不出和鉴权有关。
希望修复。
The text was updated successfully, but these errors were encountered:
代码:
`
const { hosting, storage } = CloudBase.init({
secretId: "xxx",
secretKey: "xxx",
envId: "dev-xxx"
});
// 上传文件到 cos
await storage.uploadDirectory({
localPath: path.resolve("./content"),
cloudPath: "content",
onProgress: (data) => {
console.log(data);
},
});
`
这段代码中的 secretId 给错时报错为:
(node:10516) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.stat (fs.js:1057:10)
at C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\advance.js:828:12
at Object.each (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\util.js:248:13)
at COS.uploadFiles (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\advance.js:827:10)
at COS.uploadFiles (C:\Users\daren\Desktop\guanyuedesign.com\node_modules\cos-nodejs-sdk-v5\sdk\util.js:461:29)
at internal/util.js:297:30
at new Promise ()
at COS. (internal/util.js:296:12)
...
实际的错误是:
CloudBaseError: SIGN_PARAM_INVALID: secret key not exist
也就是 sdk 在用错误的 secretId 请求云 API 时返回的错误。
这层错误被 sdk 掩盖掉了,导致实际报出来的错误完全看不出和鉴权有关。
希望修复。
The text was updated successfully, but these errors were encountered: