RedHatQuickCourses / rhods-intro

Introduction to Red Hat OpenShift AI (RHOAI)
https://redhatquickcourses.github.io/rhods-intro/
13 stars 14 forks source link

issue running data-connection exercise #61

Closed yangcao77 closed 3 months ago

yangcao77 commented 6 months ago

I followed instruction to RHOAI, and see errors when running: https://github.com/RedHatQuickCourses/rhods-intro/blob/main/notebooks/data-connections/exercise.ipynb

  1. I created aws openshift cluster using openshift installer, and worker node m6i.2xlarge
  2. workbench, minio server and data-connections were created followed the instruction.
  3. see the following error when try to list buckets response = s3.list_buckets() Note: since the cluster created via installer is with self-signed cert, so I have disabled SSL when creating the s3 client use_ssl=False
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 response = s3.list_buckets()
      2 response["Buckets"]

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:535, in ClientCreator._create_api_method.<locals>._api_call(self, *args, **kwargs)
    531     raise TypeError(
    532         f"{py_operation_name}() only accepts keyword arguments."
    533     )
    534 # The "self" in this scope is referring to the BaseClient.
--> 535 return self._make_api_call(operation_name, kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:963, in BaseClient._make_api_call(self, operation_name, api_params)
    959     maybe_compress_request(
    960         self.meta.config, request_dict, operation_model
    961     )
    962     apply_request_checksum(request_dict)
--> 963     http, parsed_response = self._make_request(
    964         operation_model, request_dict, request_context
    965     )
    967 self.meta.events.emit(
    968     'after-call.{service_id}.{operation_name}'.format(
    969         service_id=service_id, operation_name=operation_name
   (...)
    974     context=request_context,
    975 )
    977 if http.status_code >= 300:

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:989, in BaseClient._make_request(self, operation_model, request_dict, request_context)
    987 def _make_request(self, operation_model, request_dict, request_context):
    988     try:
--> 989         return self._endpoint.make_request(operation_model, request_dict)
    990     except Exception as e:
    991         self.meta.events.emit(
    992             'after-call-error.{service_id}.{operation_name}'.format(
    993                 service_id=self._service_model.service_id.hyphenize(),
   (...)
    997             context=request_context,
    998         )

File /opt/app-root/lib64/python3.9/site-packages/botocore/endpoint.py:119, in Endpoint.make_request(self, operation_model, request_dict)
    113 def make_request(self, operation_model, request_dict):
    114     logger.debug(
    115         "Making request for %s with params: %s",
    116         operation_model,
    117         request_dict,
    118     )
--> 119     return self._send_request(request_dict, operation_model)

File /opt/app-root/lib64/python3.9/site-packages/botocore/endpoint.py:202, in Endpoint._send_request(self, request_dict, operation_model)
    198 request = self.create_request(request_dict, operation_model)
    199 success_response, exception = self._get_response(
    200     request, operation_model, context
    201 )
--> 202 while self._needs_retry(
    203     attempts,
    204     operation_model,
    205     request_dict,
    206     success_response,
    207     exception,
    208 ):
    209     attempts += 1
    210     self._update_retries_context(context, attempts, success_response)

File /opt/app-root/lib64/python3.9/site-packages/botocore/endpoint.py:354, in Endpoint._needs_retry(self, attempts, operation_model, request_dict, response, caught_exception)
    352 service_id = operation_model.service_model.service_id.hyphenize()
    353 event_name = f"needs-retry.{service_id}.{operation_model.name}"
--> 354 responses = self._event_emitter.emit(
    355     event_name,
    356     response=response,
    357     endpoint=self,
    358     operation=operation_model,
    359     attempts=attempts,
    360     caught_exception=caught_exception,
    361     request_dict=request_dict,
    362 )
    363 handler_response = first_non_none_response(responses)
    364 if handler_response is None:

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:412, in EventAliaser.emit(self, event_name, **kwargs)
    410 def emit(self, event_name, **kwargs):
    411     aliased_event_name = self._alias_event_name(event_name)
--> 412     return self._emitter.emit(aliased_event_name, **kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:256, in HierarchicalEmitter.emit(self, event_name, **kwargs)
    245 def emit(self, event_name, **kwargs):
    246     """
    247     Emit an event by name with arguments passed as keyword args.
    248 
   (...)
    254              handlers.
    255     """
--> 256     return self._emit(event_name, kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:239, in HierarchicalEmitter._emit(self, event_name, kwargs, stop_on_response)
    237 for handler in handlers_to_call:
    238     logger.debug('Event %s: calling handler %s', event_name, handler)
--> 239     response = handler(**kwargs)
    240     responses.append((handler, response))
    241     if stop_on_response and response is not None:

File /opt/app-root/lib64/python3.9/site-packages/botocore/utils.py:1660, in S3RegionRedirectorv2.redirect_from_error(self, request_dict, response, operation, **kwargs)
   1658 bucket = request_dict['context']['s3_redirect']['bucket']
   1659 client_region = request_dict['context'].get('client_region')
-> 1660 new_region = self.get_bucket_region(bucket, response)
   1662 if new_region is None:
   1663     logger.debug(
   1664         "S3 client configured for region %s but the bucket %s is not "
   1665         "in that region and the proper region could not be "
   1666         "automatically determined." % (client_region, bucket)
   1667     )

File /opt/app-root/lib64/python3.9/site-packages/botocore/utils.py:1730, in S3RegionRedirectorv2.get_bucket_region(self, bucket, response)
   1728 # Finally, HEAD the bucket. No other choice sadly.
   1729 try:
-> 1730     response = self._client.head_bucket(Bucket=bucket)
   1731     headers = response['ResponseMetadata']['HTTPHeaders']
   1732 except ClientError as e:

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:535, in ClientCreator._create_api_method.<locals>._api_call(self, *args, **kwargs)
    531     raise TypeError(
    532         f"{py_operation_name}() only accepts keyword arguments."
    533     )
    534 # The "self" in this scope is referring to the BaseClient.
--> 535 return self._make_api_call(operation_name, kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:928, in BaseClient._make_api_call(self, operation_name, api_params)
    919     logger.debug(
    920         'Warning: %s.%s() is deprecated', service_name, operation_name
    921     )
    922 request_context = {
    923     'client_region': self.meta.region_name,
    924     'client_config': self.meta.config,
    925     'has_streaming_input': operation_model.has_streaming_input,
    926     'auth_type': operation_model.auth_type,
    927 }
--> 928 api_params = self._emit_api_params(
    929     api_params=api_params,
    930     operation_model=operation_model,
    931     context=request_context,
    932 )
    933 endpoint_url, additional_headers = self._resolve_endpoint_ruleset(
    934     operation_model, api_params, request_context
    935 )
    936 request_dict = self._convert_to_request_dict(
    937     api_params=api_params,
    938     operation_model=operation_model,
   (...)
    941     headers=additional_headers,
    942 )

File /opt/app-root/lib64/python3.9/site-packages/botocore/client.py:1046, in BaseClient._emit_api_params(self, api_params, operation_model, context)
   1038 responses = self.meta.events.emit(
   1039     f'provide-client-params.{service_id}.{operation_name}',
   1040     params=api_params,
   1041     model=operation_model,
   1042     context=context,
   1043 )
   1044 api_params = first_non_none_response(responses, default=api_params)
-> 1046 self.meta.events.emit(
   1047     f'before-parameter-build.{service_id}.{operation_name}',
   1048     params=api_params,
   1049     model=operation_model,
   1050     context=context,
   1051 )
   1052 return api_params

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:412, in EventAliaser.emit(self, event_name, **kwargs)
    410 def emit(self, event_name, **kwargs):
    411     aliased_event_name = self._alias_event_name(event_name)
--> 412     return self._emitter.emit(aliased_event_name, **kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:256, in HierarchicalEmitter.emit(self, event_name, **kwargs)
    245 def emit(self, event_name, **kwargs):
    246     """
    247     Emit an event by name with arguments passed as keyword args.
    248 
   (...)
    254              handlers.
    255     """
--> 256     return self._emit(event_name, kwargs)

File /opt/app-root/lib64/python3.9/site-packages/botocore/hooks.py:239, in HierarchicalEmitter._emit(self, event_name, kwargs, stop_on_response)
    237 for handler in handlers_to_call:
    238     logger.debug('Event %s: calling handler %s', event_name, handler)
--> 239     response = handler(**kwargs)
    240     responses.append((handler, response))
    241     if stop_on_response and response is not None:

File /opt/app-root/lib64/python3.9/site-packages/botocore/handlers.py:278, in validate_bucket_name(params, **kwargs)
    276     return
    277 bucket = params['Bucket']
--> 278 if not VALID_BUCKET.search(bucket) and not VALID_S3_ARN.search(bucket):
    279     error_msg = (
    280         f'Invalid bucket name "{bucket}": Bucket name must match '
    281         f'the regex "{VALID_BUCKET.pattern}" or be an ARN matching '
    282         f'the regex "{VALID_S3_ARN.pattern}"'
    283     )
    284     raise ParamValidationError(report=error_msg)

TypeError: expected string or bytes-like object
rsriniva commented 6 months ago

@yangcao77 - can you tell us the OpenShift version you are using?

rsriniva commented 6 months ago

@jramcast @rruizher - any ideas? not sure if self-signed certs is the root cause...

yangcao77 commented 6 months ago

@yangcao77 - can you tell us the OpenShift version you are using?

4.15.8

kknoxrht commented 3 months ago

Had a chance to work to duplicate this issue. Found that even when using self-signed certs - The needs to be set to use_ssl=True because you connecting to the Minio exposed service, not an openshift endpoint.

found that everything work as expected, and succeeded throughout the lab. Changing the use_ssl value to False, duplicated the error listed above.

There is no issue with the lab. Use the default values and it works as intended.