IBM / ibm-cos-sdk-python

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

Client Instantiation Fails - InvalidRegionError #42

Closed L3XANDR0 closed 1 year ago

L3XANDR0 commented 3 years ago

I attempted to run the IBM COS Python SDK example here: https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-sdk-gs

The sample code is failing when ibm_boto3.client() is called.

Exception has occurred: InvalidRegionError
     Provided region_name 'US_WEST_1' doesn't match a supported format.

The relevant code, withouth API key and service crn.

# Constants for IBM COS values
COS_ENDPOINT = "https://s3.us-south.cloud-object-storage.appdomain.cloud"
COS_API_KEY_ID = # example: xxxd12V2QHXbjaM99G9tWyYDgF_0gYdlQ8aWALIQxXx4
COS_AUTH_ENDPOINT = "https://iam.cloud.ibm.com/identity/token"
COS_SERVICE_CRN = # example: crn:v1:bluemix:public:cloud-object-storage:global:a/xx999cd94a0dda86fd8eff3191349999:9999b05b-x999-4917-xxxx-9d5b326a1111::
COS_STORAGE_CLASS = "us-south-standard"

# Create client connection
cos_cli = ibm_boto3.client("s3",
    ibm_api_key_id=COS_API_KEY_ID,
    ibm_service_instance_id=COS_SERVICE_CRN,
    ibm_auth_endpoint=COS_AUTH_ENDPOINT,
    config=Config(signature_version="oauth"),
    endpoint_url=COS_ENDPOINT
)

I'm using Python version: 3.8.3, with the following modules.

boto3==1.17.74
ibm-cloud-sdk-core==3.10.0
ibm-cos-sdk==2.10.0
ibm-cos-sdk-core==2.10.0
ibm-cos-sdk-s3transfer==2.10.0
nglange commented 3 years ago

Thanks for the report - that seems to be very strange. I wonder if there's some crosstalk happening between the vanilla boto3 library and the IBM fork. I'll poke around and see if I can figure out where the US_WEST_1 is coming from. All the code you show looks perfectly correct.

L3XANDR0 commented 3 years ago

@nglange Any movement on this?

L3XANDR0 commented 2 years ago

I continue to hit this issue.

IBMeric commented 2 years ago

@nglange Could you look at this again?

avinash1IBM commented 1 year ago

@L3XANDR0 could you please check again with. ibm-cos-sdk 2.13.0 ibm-cos-sdk-core 2.13.0 ibm-cos-sdk-s3transfer 2.13.0

avinash1IBM commented 1 year ago

We are closing this issue as resolved as there is no further communication. Please create a new issue if you are facing the same problem again.