I'm attempting to write a basic test to make sure my minio installation works correctly. I wrote a test that follows their example of using a presigned POST policy and it works just fine, but I cannot seem to create a working example of a presigned PUT. I got a 403 Forbidden
with a cause of:
cause="Signature does not match"
source="[objecthandlers.go:468:objectAPIHandlers.PutObjectHandler()]"
Here's the test code. I've promisified the minio javascript API and am using tape as the test harness. Similar code for the POST policy works just fine.
EDIT: This is an important part that was the source of the problem:
var minio = new Minio.Client({
endPoint: 'minioTest', // <- the problem
port: 9000,
secure: false,
accessKey: 'DONALDJTRUMP',
secretKey: 'DONALDJTRUMP'
});
test('should be able to PUT to a presigned URL', function(assert) {
const filename = 'signedtest2.txt';
return minio.presignedPutObjectAsync(bucket, filename, 60)
.then(url => {
assert.ok(url.length > 200, 'URL is non empty');
console.log(url);
return agent
.put(url)
.set('Content-Type', 'text/plain')
.attach('file', 'test/data/test.txt');
}).then(r => {
assert.ok(r.ok);
console.log(JSON.stringify(r, null, 2));
}).catch(err => {
assert.fail('got error', err);
console.log(err);
});
});
What am I doing wrong that gets me a 403 Forbidden?