andrewrk/node-s3-client

signatureVersion v3 AccessDenied, v4 works but only directly with aws-sdk

Opened this issue ยท 39 comments

I'm trying to use s3client.uploadFile.

If I set signatureVersion to "v3", the only way I can upload without getting AccessDenied is to make the bucket read/write from everyone. Obviously I don't want to do that.

If I set the signatureVersion to "v4", I get [Error: Non-file stream objects are not supported with SigV4 in AWS.S3]

I just built a side example using aws-sdk:2.1.4. I initialize the client with the same parameters and then

var params = {
    Bucket: "myBucket",
    Key: "testing.txt",
    Body: 'Hello!'
};

awsS3Client.putObject(params, function (err, data) {
    if (err)
        console.log(err);
    else console.log("Successfully uploaded data to ", params.Bucket, params.Key);
});

This works fine using the same bucket and IAM credentials.

So I have a feeling that however my bucket policy is setup (or maybe you can't define a v3 policy anymore), it won't let me use v3. But then it seems node-s3 doesn't work with v4.

Can anyone confirm this? I am passing a filename and not a stream, but it looks like internally it's chunking the file or something?

I just hit the same error. Trying to get a basic upload going but hit the same problem. With v3, it is denying access saying that I need to use v4. With v4, I get the same Non-file stream objects error.

I have the same issue trying to upload / sync dir with Frankfurt. First I got an error saying that only SigV4 is supported in Frankfurt. Then, got Non-file stream objects error

Any plan to fix this issue?

This is not a solution, but for anyone coming across this, my solution was to instead use the knox s3 library https://github.com/LearnBoost/knox

This makes the module unusable in the newer v4-only regions. Would be great if the issue could be fixed.

I'd love to see a fix for this issue as well. Is there anything I can do to help with this?

I have the same problem with eu-central-1 region only supporting the new authorization mechanism.

Would be great if this issue would be fixed.

+1. Really annoying.

+1

+1

+1 is it still and issue ?

This issue is waiting for a PR from one of the glorious community members

Really?

I'm not sure why that's surprising

kaore commented

followed @fform solution and switched to knox

+1

I hope this can be fixed soon...

probably the same issue is #128

+1

Is there any workaround for this issue? Or has anybody investigated what's causing the error?

+1

+1

+1 has there been any fix for this?

when you guys trying to fix this issue :( , its a new version issue

ifl0w commented

The aws-sdk dependency of this package seems to be out of date and to cause this problem.
An easy workaround that worked for me is to create a client from an existing aws object of the newest aws-sdk version.

This function is also described in the documentation:
https://github.com/andrewrk/node-s3-client#create-a-client-from-existing-awss3-object

I also included a little code snippet for better understanding:

var s3 = require('s3'); // https://github.com/andrewrk/node-s3-client
var AWS = require('aws-sdk'); // https://www.npmjs.com/package/aws-sdk

// use newest sdk to avoid: https://github.com/andrewrk/node-s3-client/issues/69
var awsS3Client = new AWS.S3();

var client = s3.createClient({
  s3Client: awsS3Client
});

So I think updating the dependencies of this package would remove the problem.

Hi ,

This issue , I have fixed and send pull request, please check and merge it with master ,

+1

+1

I don't have permission to push npm updates, so I've forked this to: https://github.com/faceleg/node-s3-client.

npm i @faceleg/s3

The workaround @ifl0w proposed worked fine for me.

+1. I still have this issue