Open response assignment (ORA) upload file "Could not retrieve upload url"

Hi all,

I am facing a problem while uploading files against ORA. I am trying to upload file on my local machine and using the following configuration in my app/edxapp/edx-platform/lms/envs/common.py

RA2_FILEUPLOAD_BACKEND = "filesystem"
ORA2_FILEUPLOAD_CACHE_NAME= "default"
ORA2_FILEUPLOAD_ROOT = os.path.join(MEDIA_ROOT, 'ora-upload/')

Here is an image of my problem :

Am I missing something ?

When you see a 500 error, it means that there is an error report in the server logs. That’s where you should look for clues to the problem.

Following is error I can see in my logs :

Nov 13 13:51:54 ip-172-31-10-58 [service_variant=lms][courseware.module_render][env:sandbox] ERROR [ip-172-31-10-58  4292] [module_render.py:1210] - error executing xblock handler
Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/lms/djangoapps/courseware/module_render.py", line 1185, in _invoke_xblock_handler
    resp = handler_instance.handle(handler, req, suffix)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py", line 89, in handle
    return self.runtime.handle(self, handler_name, request, suffix)
  File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1365, in handle
    return super(MetricsMixin, self).handle(block, handler_name, request, suffix=suffix)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/runtime.py", line 1037, in handle
    results = handler(request, suffix)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py", line 74, in wrapper
    return Response(json.dumps(response), content_type='application/json', charset='utf8')
  File "/usr/lib/python2.7/json/__init__.py", line 244, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.7/json/encoder.py", line 184, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: u'/openassessment/fileupload/submissions_attachments/90b6cf0e4c7baf7f2624baa61346a11f/course-v1:TPS+TPS001+2019_TPS1/block-v1:TPS+TPS001+2019_TPS1+type@openassessment+block@538c91d005ca4563a46c4091cbf2db99/' is not JSON serializable

As I can see in above error json.dump() fails to create JSON from object passed in /edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py

Mr. @omar even highlighted something similar here : Translate the default XBlock data - #3 by omar

Will it be right to use following code inside xblock/mixins.py

from rest_framework.utils.encoders import JSONEncoder
value = json.dumps(..., cls=JSONEncoder)

For file “/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/xblock/mixins.py”, line 74, in wrapper

return Response(json.dumps(response), content_type=‘application/json’, charset=‘utf8’)

@wak120191 Good catch! This issue was fixed in release 2.2.2: https://github.com/edx/edx-ora2/pull/1144/files

Unfortunately, ironwood ships with 2.2.0. I suggest you upgrade edx-ora2 to 2.2.2.

1 Like

@regis thanks. It worked :slight_smile:

I am so glad to have highly supporting openedX community.

1 Like