ORA: File Upload issue with ap-south-1 S3 Bucket

Hello all,

In ORA we are trying to upload files and getting some errors.

We have configured all necessary settings for s3 bucket and it is working fine with this (profile picture, grade downloads, course import/export) but not with ORA file upload.

Error trace:

2020-07-16 10:16:30,771 ERROR 7386 [openassessment.xblock.submission_mixin] submission_mixin.py:352 - Error retrieving download URL.
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/openassessment/xblock/submission_mixin.py", line 350, in _get_download_url
    return file_upload_api.get_download_url(self._get_student_item_key(file_num))
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/openassessment/fileupload/api.py", line 22, in get_download_url
    return backends.get_backend().get_download_url(key)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/openassessment/fileupload/backends/s3.py", line 44, in get_download_url
    raise FileUploadInternalError(ex)
FileUploadInternalError: BotoClientError: When using SigV4, you must specify a 'host' parameter.

open edX release: open-release/hawthorn.master
bucket region: ap-south-1

Getting the same with open-release/ironwood.master

I know that ap-south-1 is using Sigv4 (US regions are using the Sigv2) signing method so I have added host while creating s3 connection. This helped me to pass the above-mentioned error but if I upload a file for ORA then it is saying that you have been logged out. Please see the screenshot below:

Any help with this?

1 Like

ORA file uploads to AWS S3 only works when your ec2 and s3 bucket is located in the us region. I found out the hard way after migrating from the eu-west region.

Hi @nabeelmerchant1,

Thanks for your response.

Yes, this is a painful thing. But we have to keep our buckets in the ap-south-1 region and to achieve this we have made the following changes:

Boto side:

open-edx side:
add AWS_S3_HOST in common.py

AWS_S3_HOST = 's3.ap-south-1.amazonaws.com'

ORA side:

1 Like

Hello, @jramnai, @nabeelmerchant1

Can you help to config ORA2 file upload using S3 Bucket ?
I’m with the same problem, it is working fine with this (profile picture, grade downloads) but not with ORA2 file upload.

I’m using us-east-1 .

@nabeelmerchant1
I tested in a VM in us-east-1a and a bucket in us-east-1 and didn’t work.

@erickhgm, you have tried the marked solution? And what are your observation/findings after making the aforementioned changes?

Thank you for the answer @jramnai

I had understood that these modifications were already made (boto and ORA side), that I should use the most recent versions of the repertory.

After debugging the edx/ora2 code I figured out what was happening.

The backend (python) doesn’t log any message with the error that was happening because the upload request is done by the frontend (javascript).

The upload URL is getting here and the upload is done here. With this, I inspect using the browser and could see a CORS problem.

My CORS config:

[
    {
        "AllowedHeaders": [
            "Content-disposition",
            "Content-type",
            "X-CSRFToken"
        ],
        "AllowedMethods": [
            "GET",
            "PUT"
        ],
        "AllowedOrigins": [
            "http://my-test-domain.com"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]

I’m using this tutor plugin: tutor-contrib-s3 is a easy way to configure a S3 Bucket, because all the documentation that I found is old and doesn’t work.

1 Like