Closed jhaaken closed 2 years ago
FYI, we are looking into this and will get back to you.
@jhaaken We have been able to reproduce the issue. Your test code creates a client that has never used its credentials, so no IAM token has been populated. The detection logic isn't accounting for this case, so the non-S3 operation upload
isn't being handled correctly. We now have an internal defect for this.
There are two workarounds: (1) Continue to use signatureVersion: "iam"
, (2) Perform any S3 operation with the client (e.g., headBucket
) to retrieve an IAM token before doing upload
.
FYI, we have a fix staged for our next SDK release.
We have resolved this issue with the release of 1.11.0. Can you verify and close this ticket?
Closing as resolved
was supposed to be fixed in #83 and release 1.10.2 if I understand the resolution of the defect, but I am still needing to provided a signatureVersion of
iam
to get it to properly authenticate. If that is what the solution should be that is fine, just need to make sure documentation is adjusted. As posted in #83 it looks like the method is defaulting tov4
.node version
simple script
const bucket = '';
const key = 'some-test/1234/hello-world.txt';
try { console.log(
file key ${key}
);const cos = new IBMCOS.S3(cosConfig);
const buffer = Buffer.from('hello world');
const payload = { Bucket: bucket, Key: key, Body: buffer, Metadata: { fileExt:
.txt
, }, };cos.upload(payload, function(err, data) { if (err) { console.log('error', err); } else { console.log('success', data); } });
} catch (error) { console.log(error); }
Originally posted by @jhaaken in https://github.com/IBM/ibm-cos-sdk-js/issues/83#issuecomment-904152798