Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

s3param doesn't seem to be send along with server-initiated file uploads #21

Open
lindhard opened this issue Nov 11, 2016 · 5 comments
Open

Comments

@lindhard
Copy link

const options =
{
key: 'XX'
, secret: 'YY'
, bucket: 'stacktapimages'
, region: 'eu-central-1'
// Let's use the custom s3params to upload this file as publicly readable by anyone
, s3params:
{
ContentType: 'image/jpeg',
ACL: 'public-read'
}
}
sails.s3 = require('skipper-better-s3')(options);

The file does upload to S3, but if I check the uploaded file it doesn't have the correct mime type nor does it have the permission for everyone to open/download.

the following is the part that uploads to the file to s3:

const receiver = sails.s3.receive()
receiver.write(file, () => {

@innovationnow
Copy link

same issue here

@innovationnow
Copy link

const options =
{ key: 'xxxxxxxxx'
, secret: 'zzzzzzz'
, bucket: 'sssss'
, s3params:
{ ACL: 'public-read',
'x-amz-acl': 'public-read',
StorageClass: 'REDUCED_REDUNDANCY'
}
}
// This will give you an adapter instance configured with the
// credentials and bucket defined above
, adapter = require('skipper-better-s3')(options)
const receiver = adapter.receive({ContentType: 'application/zip',
ACL: 'public-read',
'x-amz-acl': 'public-read',
StorageClass: 'REDUCED_REDUNDANCY'
});

                              // Suppose we want to upload a file which we temporarily saved to disk 
                              const file = fs.createReadStream(target)
                               
                              // And now, just send the file to the receiver! 
                              receiver.write(file, () => {
                                // Upload complete! You can find some interesting info on the stream's 
                                // `extra` property 
                                console.log(file.extra)
                              })

the file uploaded but permission and StorageClass are wrong

@eltonk
Copy link

eltonk commented Feb 13, 2019

Not sure if it's the same issue, but I'm trying to pass the signature_version thought the s3config parameter and also it's failing...

const options =
{ key: 'MyKey',
secret: 'MySecret',
s3config: {
signature_version: 's3v4'
},
bucket: 'mybucket'
}
, adapter = require('skipper-better-s3')(options);

const url = adapter.url('getObject', { s3params: { Key: 'avatar.jpg' } })

and the error

InvalidRequest The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. 21F128804941FB24 wp4cFOh2aNdfWAFpljs6CkJNi24hkWOfUDkWqEb4QEE6tSwrzBqSU8Iq9b9NAuD2UuQhG0/KiME=

@eltonk
Copy link

eltonk commented Nov 15, 2019

any idea here? still same problem :(

@taihuynhpt
Copy link

taihuynhpt commented Feb 15, 2020

You should put all params in s3params

const receiver = adapter.receive({
s3params: {
ACL: 'public-read',
StorageClass: 'REDUCED_REDUNDANCY'
}
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants