Tutor Minio AWS S3

Hi,Im trying to use this plugin for using our AWS S3 bucket. I have installed this plugin and enabled it.

Below is the error I’m getting when I upload a profile image.

lms_1                        | During handling of the above exception, another exception occurred:
lms_1                        | 
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
lms_1                        |     response = get_response(request)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
lms_1                        |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 75, in inner
lms_1                        |     return func(*args, **kwds)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
lms_1                        |     return view_func(*args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
lms_1                        |     return self.dispatch(request, *args, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
lms_1                        |     response = self.handle_exception(exc)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
lms_1                        |     response = handler(request, *args, **kwargs)
lms_1                        |   File "/openedx/edx-platform/openedx/core/djangoapps/profile_images/views.py", line 159, in post
lms_1                        |     create_profile_images(uploaded_file, profile_image_names)
lms_1                        |   File "/openedx/edx-platform/openedx/core/djangoapps/profile_images/images.py", line 73, in create_profile_images
lms_1                        |     storage.save(name, scaled_image_file)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/files/storage.py", line 54, in save
lms_1                        |     name = self._save(name, content)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/storages/backends/s3boto3.py", line 495, in _save
lms_1                        |     self._save_content(obj, content, parameters=parameters)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/storages/backends/s3boto3.py", line 510, in _save_content
lms_1                        |     obj.upload_fileobj(content, ExtraArgs=put_parameters)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/boto3/s3/inject.py", line 511, in object_upload_fileobj
lms_1                        |     return self.meta.client.upload_fileobj(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/boto3/s3/inject.py", line 431, in upload_fileobj
lms_1                        |     return future.result()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/s3transfer/futures.py", line 73, in result
lms_1                        |     return self._coordinator.result()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/s3transfer/futures.py", line 233, in result
lms_1                        |     raise self._exception
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/s3transfer/tasks.py", line 126, in __call__
lms_1                        |     return self._execute_main(kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/s3transfer/tasks.py", line 150, in _execute_main
lms_1                        |     return_value = self._main(**kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/s3transfer/upload.py", line 692, in _main
lms_1                        |     client.put_object(Bucket=bucket, Key=key, Body=body, **extra_args)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/client.py", line 317, in _api_call
lms_1                        |     return self._make_api_call(operation_name, kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/client.py", line 601, in _make_api_call
lms_1                        |     http, parsed_response = self._endpoint.make_request(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/endpoint.py", line 143, in make_request
lms_1                        |     return self._send_request(request_dict, operation_model)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/endpoint.py", line 171, in _send_request
lms_1                        |     while self._needs_retry(attempts, operation_model, request_dict,
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/endpoint.py", line 262, in _needs_retry
lms_1                        |     responses = self._event_emitter.emit(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/hooks.py", line 227, in emit
lms_1                        |     return self._emit(event_name, kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/hooks.py", line 210, in _emit
lms_1                        |     response = handler(**kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 183, in __call__
lms_1                        |     if self._checker(attempts, response, caught_exception):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 250, in __call__
lms_1                        |     should_retry = self._should_retry(attempt_number, response,
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 277, in _should_retry
lms_1                        |     return self._checker(attempt_number, response, caught_exception)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 316, in __call__
lms_1                        |     checker_response = checker(attempt_number, response,
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 222, in __call__
lms_1                        |     return self._check_caught_exception(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
lms_1                        |     raise caught_exception
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/endpoint.py", line 210, in _get_response
lms_1                        |     http_response = self.http_session.send(
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/vendored/requests/sessions.py", line 573, in send
lms_1                        |     r = adapter.send(request, **kwargs)
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/botocore/vendored/requests/adapters.py", line 415, in send
lms_1                        |     raise ConnectionError(err, request=request)
lms_1                        | botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionRefusedError(111, 'Connection refused'))

UPDATE:
The above issue is resolved, I was not supposed to set the MINIO_HOST_NAME.

Now I have ran into another issue where the object URLS are not correct.
Received URLhttps://s3.amazonaws.com/<bucket_name>/openedx/media/profile-images/312cab5a5442c7c4beff1dcedde3dde8_500.jpg
Expected object URL – https://<bucket_name>.s3.<s3_region>.amazonaws.com/openedx/media/profile-images/312cab5a5442c7c4beff1dcedde3dde8_120.jpg

Hi,

if you want to use “actual” AWS S3, rather than MinIO, you’re using the wrong plugin. Look at this one instead:

Cheers,
Florian

2 Likes

Hello @fghaas, Thanks for sharing it, and yes, have switched to that plugin now.