1

后端:CognitoS3

前端:React带有aws-amplify.

基本功能有效。我现在需要对 S3 存储桶中的目录进行细粒度的访问控制。例如user-test,只能访问s3::my-bucket/user-test

该计划是将用户属性(用于访问控制的主体标记属性)添加到联合身份中,可以在授权策略中基于每个用户进行引用。但是,Amplify Storage 组件会因任何用户属性而中断。

任何存储请求(list、get、put...)都会返回此错误:

AWSS3Provider - get signed url error TypeError: Cannot read properties of undefined (reading 'byteLength')
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'byteLength')
    at isEmptyData (isEmptyData.ts:11)
    at Sha256.update (webCryptoSha256.ts:32)
    at Sha256.update (crossPlatformSha256.ts:23)
    at hmac (credentialDerivation.ts:69)
    at credentialDerivation.ts:39
    at step (tslib.es6.js:100)
    at Object.next (tslib.es6.js:81)
    at tslib.es6.js:74
    at new Promise (<anonymous>)
    at __awaiter (tslib.es6.js:70)
    at getSigningKey (credentialDerivation.ts:37)
    at SignatureV4.getSigningKey (SignatureV4.ts:307)
    at SignatureV4.<anonymous> (SignatureV4.ts:153)
    at step (tslib.es6.js:100)
    at Object.next (tslib.es6.js:81)
    at fulfilled (tslib.es6.js:71)

我怀疑我的用例超出了 的范围aws-amplify,我应该改用什么?

4

0 回答 0