2

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?

Paul S
  • 892
  • 10
  • 25

2 Answers2

3

either SuperAgent, minio-js or or the minio server does not like having an upper case character in the hostname (the endPoint). Alas I'm using docker which auto-assigns hostnames and thus allows this if you use camelCase for container names, and I just cut and pasted the container name.

changing this line to lower case solves the problem:

endPoint: 'miniotest',     // <- this must be lower case

Hostnames are case insensitive so it should not have mattered.. I haven't identified which component it is, but something is likely coercing to lower case when generating or validating the signature and thus they don't match.

I note I did not have to change the container away from camelCase.

Community
  • 1
  • 1
Paul S
  • 892
  • 10
  • 25
2

@paul We have addressed this issue and it is fixed in the source. Kindly upgrade.

koolhead17
  • 1,944
  • 1
  • 12
  • 20