Amazon S3 EPIPE错误 [英] Amazon S3 EPIPE Error

查看:148
本文介绍了Amazon S3 EPIPE错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:添加完整的内容后,通过命令行"对该用户的访问策略权限.现在,当我使用Node进行操作时,没有错误,但是在s3文件管理器中看不到文件.

UPDATE: got it working from the commandline after add a full access policy permissions to that user. Now when I do it with Node there is no error but I can't see the files in my s3 file manager.

我使用Amazon的S3服务不断收到EPIPE错误.

I keep getting an EPIPE error using Amazon's S3 service.

我有点困惑,不确定如何进行.

I am a little stuck and unsure of how to proceed.

我正在将Node.js与 Knox模块一起使用.

I am using Node.js with the Knox module.

这是我的代码:

var client = knox.createClient({
    key: amazonAccessKeyId,
    secret: amazonSecretAccessKey,
    bucket: amazonBucketName
});

function moveFiles() {
    moveUploadedFile(req.files['aps-file'].path,'/aps-products.csv', this.parallel());
    moveUploadedFile(req.files['perry-craft-roof-file'].path,'/perry-craft-roof-products.csv', this.parallel());
    res.end('successful!');
}

function moveUploadedFile(srcPath, dstPath, callback) {
    client.putFile(srcPath, dstPath, { 'x-amz-acl': 'public' }, function (err) {
        if (err) {
            callback(new Error("Error uploading file for " + dstPath + ": " + err.message), srcPath);
            console.log(err);
            return;
        }

        console.log('Finished writing file ' + dstPath + ' to Amazon S3 Cloud');
        callback(null, srcPath);
    });
}

推荐答案

好的,这些是我用来解决此问题的步骤:

Ok so these are the steps I took to resolve this problem:

  1. 已安装的aws命令行工具,您可以在这里找到: http://www.timkay.com/aws/
  2. 向我创建的s3用户添加了完全访问(管理员访问)策略.
  3. 请确保我可以使用以下命令向该存储桶写入数据: aws put/file/to/put/new-file .
  4. 已删除 {'x-amz-acl':'public'} ,它应为'public-read',否则不会将文件添加到s3(无错误).请注意, {'x-amz-acl':'private'} 也可以.
  1. Installed aws commandline tool you can find it here: http://www.timkay.com/aws/
  2. Added a Full Access (Administrator Access) policy to the s3 user I created.
  3. Made sure I can write to that bucket using the command: aws put /file/to/put /new-file.
  4. Removed {'x-amz-acl': 'public' } it should be 'public-read' otherwise it will not add the files to s3 (without errors). Note that {'x-amz-acl': 'private' } works too.

这篇关于Amazon S3 EPIPE错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆