New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need v2 signing to create compatible signed url for DO #1776
Comments
@sam0x17 I just tested generating 'v2' signed URLs using the latest version of the SDK, and so far haven't been able to reproduce your issue. // force signature version v2
var url = new AWS.S3({signatureVersion: 'v2'}).getSignedUrl('putObject', {Bucket: 'BUCKET', Key: 'KEY'}) |
@chrisradek ok I tried it that way and now I actually get a signed URL back (before I was putting signatureVersion in the wrong place, turns out), however I am still getting SignatureDoesNotMatch when I try to PUT to the signed URL Here is what I am putting in to my rest client: Maybe there is some header I am supposed to be sending that I am not sending?? I am using the latest version of the |
@chrisradek here is my code: const secureRandom = require('secure-random');
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./credentials.json');
var s3 = new AWS.S3({signatureVersion: 'v2'});
function randomAlphaNumeric(size) {
return secureRandom(size * 2, {type: 'Buffer'})
.toString('base64')
.replace(/[\/+=]/g, '')
.substring(0, size);
}
exports.requestUploadUrl = function requestUploadUrl(req, res) {
var key = randomAlphaNumeric(16);
s3.getSignedUrl('putObject', {Key: key, Bucket: 'bitfort', Expires: 1000000}, function (err, url) {
res.send(url);
console.log('The URL is', url);
if(err) throw err;
});
} |
@sam0x17 Can you test your URLs against S3 itself? Unfortunately, since your tests are against a 3rd party service there's not much I can do to determine why you're receiving that error. The issue may be with the service itself. If you have the same issue when making requests against Amazon S3, then I'd be happy to help! |
@chrisradek I just tried with my s3 bucket and got the same issue, so I don't think it's specific to digitalocean. response from s3:
|
@sam0x17 You would either need to upload the binary (you should be able to specify a Blob as the body), or use a presigned Post instead. |
ah, that is probably my problem -- thank you! |
@chrisradek ok I changed it to upload just a blob. I tried "any file data" (no content type) and application/octet-stream, still got the same error for both: |
@chrisradek I was able to get it to work by specifying ContentType: 'application/octet-stream' both in the signed url and in the PUT request. That said, I need to upload enormous files so I need chunked/multi-part. Is that going to work with a PUT request, or should I be using POST? |
@sam0x17 Glad you were able to get the PUT working though! |
@chrisradek OK in that case what do I need to name the file field for the POST? will it take anything? |
@sam0x17 The callback will return a There's an example of what an HTML page would look like using the presigned post. However, it just occurred to me that our implementation of presigned POST only works with signatureVersion v4, so if Digital Oceans Spaces doesn't support v4, then you'd have to resort to using a presigned PUT URL. |
@chrisradek in that case what is the max size I can squeeze into a single PUT? For my application, it is OK if the data is spread out across multiple objects on the server |
That's going to depend on what the service accepts. For S3, their FAQ states:
|
thanks |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
(using node.js in a Google Cloud Function to create a putObject presigned URL in a DigitalOcean Spaces bucket)
It looks like support has been dropped from aws-sdk for doing presigned URLs that use the v2 signing version. When I specify
signatureVersion: "v2"
I getUnsupportedSigner: Presigning only supports S3 or SigV4 signing.
. Is there a way I can generate a presigned url using the v2 signature version? I don't mind if I need to use an old version of aws-sdk or even another npm package -- just looking for a way to make this work.The text was updated successfully, but these errors were encountered: