tensorbay-python-sdk icon indicating copy to clipboard operation
tensorbay-python-sdk copied to clipboard

Cannot connect to S3

Open FayazRahman opened this issue 2 years ago • 2 comments

I'm using the following code to create an S3 storage config:

gas.create_s3_storage_config(
        "S3Provider",
        "hub-2.0-tests/cifar-10-tensorbay",
        endpoint="http://hub-2.0-tests.s3-website.us-east-1.amazonaws.com",
        accesskey_id=os.getenv("AWS_ACCESS_KEY_ID"),
        accesskey_secret=os.getenv("AWS_SECRET_ACCESS_KEY"),
        bucket_name="hub-2.0-tests",
    )

But I'm getting

Unexpected status code(500)!
===================================================================
########################## HTTP Request ###########################
"url": https://gas.graviti.com/gatewayv2/tensorbay-open-api/v1/storage-configs/s3
"method": POST
"headers": {
  "User-Agent": "python-requests/2.25.1",
  "Accept-Encoding": "gzip, deflate",
  "Accept": "*/*",
  "Connection": "keep-alive",
  "X-Token": "ACCESSKEY-c7dae4ce277842a3b47a3b683159678c",
  "X-Source": "PYTHON-SDK/1.24.0",
  "X-Request-Id": "e92eab123ec5417aad86ebfb57c206d6",
  "Content-Length": "274",
  "Content-Type": "application/json"
}
"body": {"name": "S3Provider", "filePath": "hub-2.0-tests/cifar-10-tensorbay", "endpoint": "http://hub-2.0-tests.s3-website.us-east-1.amazonaws.com", "accesskeyId": "ASIAQYP5ISLXYZQKS3X2", "accesskeySecret": "NxrQKlUTuX2ZdapSRe9aTblfmXOsr5vIzLG4erYc", "bucketName": "hub-2.0-tests"}

########################## HTTP Response ##########################
"url": https://gas.graviti.com/gatewayv2/tensorbay-open-api/v1/storage-configs/s3
"status_code": 500
"reason": Internal Server Error
"headers": {
  "Date": "Sun, 08 May 2022 14:16:42 GMT",
  "Content-Type": "application/json; charset=utf-8",
  "Content-Length": "178",
  "Connection": "keep-alive",
  "Access-Control-Allow-Origin": "*",
  "X-Kong-Upstream-Latency": "20",
  "X-Kong-Proxy-Latency": "1",
  "Via": "kong/2.0.4"
}
"content": {
  "code": "InternalServerError",
  "message": "An exception occurred inside the service, please try again later : ErrorCreateHostingFailed > ErrorCreateHostingConfigGroupIdEmpty"
}
"cost_time": 1.892544s
===================================================================

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\fayaz\miniconda3\lib\site-packages\tensorbay\client\gas.py", line 262, in create_s3_storage_config
    self._client.open_api_do("POST", "storage-configs/s3", json=post_data)
  File "C:\Users\fayaz\miniconda3\lib\site-packages\tensorbay\client\requests.py", line 126, in open_api_do
    raise ResponseErrorDistributor.get(error_code, ResponseError)(
tensorbay.exception.InternalServerError: Unexpected status code(500)! https://gas.graviti.com/gatewayv2/tensorbay-open-api/v1/storage-configs/s3!
                     {"code":"InternalServerError","message":"An exception occurred inside the service, please try again later : ErrorCreateHostingFailed \u003e ErrorCreateHostingConfigGroupIdEmpty"}

What could be the reason for this? Are there any examples I can look at? I couldn't find any in your docs.

FayazRahman avatar May 08 '22 14:05 FayazRahman

Hi, it looks like the endpoint has the wrong format, please try using

gas.create_s3_storage_config(
        "S3Provider",
        "hub-2.0-tests/cifar-10-tensorbay",
        endpoint="s3.us-east-1.amazonaws.com",
        accesskey_id=os.getenv("AWS_ACCESS_KEY_ID"),
        accesskey_secret=os.getenv("AWS_SECRET_ACCESS_KEY"),
        bucket_name="hub-2.0-tests",
    )

AChenQ avatar May 09 '22 02:05 AChenQ

@AChenQ Still gives same error

FayazRahman avatar May 09 '22 16:05 FayazRahman