微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Directus存储适配器AWS S3错误:没有写权限:

如何解决Directus存储适配器AWS S3错误:没有写权限:

我决定在我们的一个项目中将Directus用作无头CMS。为了存储媒体文件,我们决定使用AWS S3作为存储适配器。我已经按照Directus文档中的所有说明进行操作,如何设置S3的配置,但是我一直在收到此错误

message: "No permission to write: 122d303f-b69a-48f8-8138-8f3404b3c992.jpg"

我已经从CLI命令尝试了AWS S3存储桶,我可以在那里上传文件并列出文件,但是从Directus上我没有写错误的权限。

Directus中的存储配置如下:

 'storage' => [
    'adapter' => 's3',// What storage adapter to use for files
                            // Defaults to the local filesystem. Other natively supported
                            // options include: Amazon S3,Aliyun OSS,Azure
                            // You'll need to require the correct flysystem adapters through Composer
                            // See https://docs.directus.io/extensions/storage-adapters.html#using-aws-s3
    'root' => '/originals',// Where files are stored on disk
    'thumb_root' => '/thumbnails',// Where thumbnails are stored on disk
    'root_url' => '##S3_URL##/originals',// Where files are accessed over the web        
    // 'proxy_downloads' => false,// Use an internal proxy for downloading all files
    // S3
    ////////////////////////////////////////
    'key'    => '##S3_KEY##','secret' => '##S3_SECRET##','region' => '##S3_REGION##','version' => 'latest','bucket' => '##S3_BUCKET##','options' => [
       'ACL' => 'public-read','CacheControl' => 'max-age=604800'
    ],],

任何人都可以对此提供任何见识吗?

谢谢。

解决方法

需要添加以下内容

'options' => [
    'ACL' => 'private',],

我发现我不需要更新存储桶策略。尝试上传到私有存储桶时,只需将其添加到config.php中即可。

,

我有同样的问题。 就我而言,我在存储桶中允许了“ s3:PutObjectAcl”,它开始工作:) 看来这是一个flysystem问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。