Error Trying to Export Case data

On our local instance , when trying to add new there is an error on Export Case Data.

Hi Andinet,

Could you please have a look at the 'Console' tab in the browser's Dev Tools to see if there are any errors. Furthermore, are you able to have a look at the Django web process logs to see if there are any errors happening from the server-side?

Hi @zandre_eng,

There is no any associated error message from the Django log.
Message below is found from Dev Tools.

common.js:2     GET https://www.echisethiopia.org/a/fmoh-echis/data/export/get_app_data_drilldown_values/?is_deid=false&is_odata=false&model_type=case 500

Thanks,

Hi @sirajhassan,

A 500 error indicates a server-side error is happening. To be able to further diagnose we need to find out what the specific error is. If you are using Sentry for error tracking, you could have a look there. Otherwise, regarding the Django logs these should be located in /home/cchq/www/<env>/log/django.log (where <env> is the name of your CommCare environment). Is this the Django log you referred to as not containing any errors?

Sorry @zandre_eng, I have been watching the first two web servers log. I got it from the third web server now.

2023-05-26 12:49:25,919 ERROR [django.request] Internal Server Error: /a/fmoh-echis/data/export/get_app_data_drilldown_values/
Traceback (most recent call last):
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/python_env-3.9/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/python_env-3.9/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/python_env-3.9/lib/python3.9/site-packages/sentry_sdk/integrations/django/views.py", line 85, in sentry_wrapped_callback
    return callback(request, *args, **kwargs)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/python_env-3.9/lib/python3.9/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/domain/decorators.py", line 111, in _inner
    return call_view()
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/domain/decorators.py", line 84, in call_view
    def call_view(): return view_func(req, domain_name, *args, **kwargs)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/export/views/list.py", line 876, in get_app_data_drilldown_values
    response = rmi_helper.get_case_rmi_response(include_any_app=True)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/fields.py", line 705, in get_case_rmi_response
    case_types_by_app = self._get_cases_for_apps(apps_by_type, self.as_dict, include_any_app=include_any_app)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/fields.py", line 633, in _get_cases_for_apps
    app = get_app(self.domain, app_choice.id)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/dbaccessors.py", line 246, in get_app
    return wrap_app(app, wrap_cls=wrap_cls)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/dbaccessors.py", line 154, in wrap_app
    return cls.wrap(app_doc)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 4579, in wrap
    self = super(Application, cls).wrap(data)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 4108, in wrap
    self = super(ApplicationBase, cls).wrap(data)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 3847, in wrap
    self = super(LazyBlobDoc, cls).wrap(data)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/blobs/mixin.py", line 89, in wrap
    return super(BlobMixin, cls).wrap(data)
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 3826, in __init__
    super(LazyBlobDoc, self).__init__(*args, **kwargs)
  File "jsonobject/base.pyx", line 202, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/base.pyx", line 235, in jsonobject.base.JsonObjectBase.set_raw_value
  File "jsonobject/base.pyx", line 274, in jsonobject.base.JsonObjectBase.__wrap
  File "jsonobject/base_properties.pyx", line 180, in jsonobject.base_properties.JsonContainerProperty.wrap
  File "jsonobject/containers.pyx", line 24, in jsonobject.containers.JsonArray.__init__
  File "jsonobject/properties.pyx", line 154, in jsonobject.properties.ObjectProperty.wrap
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 2256, in wrap
    return AdvancedModule.wrap(data)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 2264, in wrap
    return super(ModuleBase, cls).wrap(data)
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 2231, in __init__
    super(ModuleBase, self).__init__(*args, **kwargs)
  File "jsonobject/base.pyx", line 202, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/base.pyx", line 235, in jsonobject.base.JsonObjectBase.set_raw_value
  File "jsonobject/base.pyx", line 274, in jsonobject.base.JsonObjectBase.__wrap
  File "jsonobject/base_properties.pyx", line 180, in jsonobject.base_properties.JsonContainerProperty.wrap
  File "jsonobject/containers.pyx", line 24, in jsonobject.containers.JsonArray.__init__
  File "jsonobject/properties.pyx", line 154, in jsonobject.properties.ObjectProperty.wrap
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 1056, in wrap
    return AdvancedForm.wrap(data)
  File "/home/cchq/www/echis/releases/2023-05-25_15.51/corehq/apps/app_manager/models.py", line 1062, in wrap
    return super(FormBase, cls).wrap(data)
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "jsonobject/base.pyx", line 202, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/base.pyx", line 235, in jsonobject.base.JsonObjectBase.set_raw_value
  File "jsonobject/base.pyx", line 274, in jsonobject.base.JsonObjectBase.__wrap
  File "jsonobject/properties.pyx", line 154, in jsonobject.properties.ObjectProperty.wrap
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "jsonobject/base.pyx", line 202, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/base.pyx", line 235, in jsonobject.base.JsonObjectBase.set_raw_value
  File "jsonobject/base.pyx", line 274, in jsonobject.base.JsonObjectBase.__wrap
  File "jsonobject/base_properties.pyx", line 180, in jsonobject.base_properties.JsonContainerProperty.wrap
  File "jsonobject/containers.pyx", line 24, in jsonobject.containers.JsonArray.__init__
  File "jsonobject/properties.pyx", line 154, in jsonobject.properties.ObjectProperty.wrap
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "jsonobject/base.pyx", line 202, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/base.pyx", line 235, in jsonobject.base.JsonObjectBase.set_raw_value
  File "jsonobject/base.pyx", line 274, in jsonobject.base.JsonObjectBase.__wrap
  File "jsonobject/base_properties.pyx", line 180, in jsonobject.base_properties.JsonContainerProperty.wrap
  File "jsonobject/containers.pyx", line 148, in jsonobject.containers.JsonDict.__init__
  File "jsonobject/containers.pyx", line 155, in jsonobject.containers.JsonDict.__wrap
  File "jsonobject/properties.pyx", line 154, in jsonobject.properties.ObjectProperty.wrap
  File "jsonobject/base.pyx", line 251, in jsonobject.base.JsonObjectBase.wrap
  File "jsonobject/base.pyx", line 196, in jsonobject.base.JsonObjectBase.__init__
  File "jsonobject/utils.pyx", line 9, in jsonobject.utils.check_type
jsonobject.exceptions.BadValueError: JsonObject must wrap a dict or None. Found object of type: <class 'str'>

Thanks,

Thank you for the stack trace. This error seems similar to the one found in this post. It sounds like the migration for migrate_to_conditional_case_update was not run correctly.

Could you try following the recommended steps from the above post, which are as follows:

Create a private release with a previous version:

cchq echis deploy --private --commcare-rev=3c47a08dad06c20f376b25ce2bcd4f307ff5f6e6

And then run the migrate_to_conditional_case_update command:

cchq echis django-manage --release <name of private release> migrate_to_conditional_case_update --force-run-again --start-from-scratch

# and again for deleted apps
cchq echis django-manage --release <name of private release> migrate_to_conditional_case_update --deleted-apps-only --force-run-again --start-from-scratch
1 Like

Thank you so much Zandre, the recommended steps solved the issue.

1 Like