IBM / ibm-cos-sdk-js

ibm-cos-sdk-js
Apache License 2.0
38 stars 19 forks source link

Unable to create / view buckets in eu-de #49

Closed dprosper closed 5 years ago

dprosper commented 5 years ago

I am attempting to create bucket in eu-de using the Public endpoint for the geo: https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints-geo

I specified the locationconstraing as eu-standard https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-classes#classes-locationconstraint

Using the code sample here I am not able to create a bucket https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-node#node-examples-new-bucket

Using the code sample here I am not able to list a bucket that I created via the UI. https://cloud.ibm.com/docs/services/cloud-object-storage?topic=cloud-object-storage-node#node-examples-list-buckets

When print out the cos object from the let cos = new ibmcossdk.S3(cos_config); line the content includes:

image

Am I missing something?

dprosper commented 5 years ago

maybe chasing the wrong lead, but should this be?:

https://github.com/IBM/ibm-cos-sdk-js/blob/c20e0b884ac72b6b511079cc28e80336a4fed88a/lib/request.js#L315

seamus-mcgrath commented 5 years ago

Hi @dprosper have you tried location constraint eu-de-standard for your eu-de endpoint

dprosper commented 5 years ago

I just did, however same results, no bucket is created...no errors either...

However, the problem was in my code:

I did not realize that .promise() was required and missing from my code, so I had this originally:

  await cos.createBucket({
      Bucket: bucketName,
      CreateBucketConfiguration: {
        LocationConstraint: 'eu-de-standard'
      }
  });

and once I changed to this, it worked:

  await cos.createBucket({
      Bucket: bucketName,
      CreateBucketConfiguration: {
        LocationConstraint: 'eu-de-standard'
      }
  }).promise();

The way to invoke this command is a bit different from what I am used to. Thank you for looking into it, I should have re-read the examples more carefully.