IBM / ibm-cos-sdk-python

ibm-cos-sdk-python
Apache License 2.0
44 stars 26 forks source link

ibm-cos-sdk-python cos_credentials file not working as described in README #45

Closed powellquiring closed 11 months ago

powellquiring commented 2 years ago
cat ~/.bluemix/cos_credentials
{
  "apikey": "zzzzzzzzzzzzzz--XTe",
  "endpoints": "https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints",
  "iam_apikey_description": "Auto-generated for key 34f869a1-e52f-4e89-b2dc-4d3fbe0d6fb4",
  "iam_apikey_name": "vpc3tier-cos-key",
  "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Writer",
  "iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/713c783d9a507a53135fe6793c37cc74::serviceid:ServiceId-510853c5-3fa9-470b-a1ff-233340cced0e",
  "resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/zzzzzzzzzzzzzzzzzz:017a0d19-ded7-436e-bb36-zzzzzzzzzzzz::"
}

Code:

s3 = ibm_boto3.resource('s3')
bucket = s3.Bucket('vpc3tier-000-data')
print(bucket.creation_date)

Exception:

...
  File "/Users/pquiring/github.ibm.com/portfolio-solutions/scenario-3tier/venv/lib/python3.9/site-packages/ibm_botocore/signers.py", line 90, in handler
    return self.sign(operation_name, request)
  File "/Users/pquiring/github.ibm.com/portfolio-solutions/scenario-3tier/venv/lib/python3.9/site-packages/ibm_botocore/signers.py", line 162, in sign
    auth.add_auth(request)
  File "/Users/pquiring/github.ibm.com/portfolio-solutions/scenario-3tier/venv/lib/python3.9/site-packages/ibm_botocore/auth.py", line 368, in add_auth
    signature = self.signature(string_to_sign, request)
  File "/Users/pquiring/github.ibm.com/portfolio-solutions/scenario-3tier/venv/lib/python3.9/site-packages/ibm_botocore/auth.py", line 348, in signature
    k_date = self._sign(('AWS4' + key).encode('utf-8'),
IBMeric commented 2 years ago

We have someone who will look into this and get back to you.

IBMeric commented 2 years ago

The readme is out of sync with the official documentation here: https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-python#python-credentials. We will update this.

IBMeric commented 2 years ago

We have resolved this issue with the release of 2.11.0. Can you verify and close this ticket?

powellquiring commented 2 years ago

In the readme:

image

This did not get me to anything useful https://cloud.ibm.com/docs/services/cloud-object-storage/iam/service-credentials.html

pjamison-coursera commented 2 years ago

I am having a similar issue, just installed 2.11.0 today. Here is the function which seems to be causing the issue

image

image

IBMeric commented 2 years ago

Thanks for pointing this out. The COS documentation is going through an overhaul, and that seems to be affecting our readme. I'm going to have an internal discussion to see how to more permanently fix these discrepancies.

avinash1IBM commented 12 months ago

This issue has been fixed in the latest release. Can you please close this issue

IBMalok commented 11 months ago

Closing since the fix was already provided.