Couchdbkit Exceptions

Hi All,

Message below is appearing when try to open eCHIS HEW Application (Linked)

This is its error message from the log:
Traceback (most recent call last):
File "/home/cchq/www/echis/releases/2023-05-04_20.02/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-04_20.02/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-04_20.02/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-04_20.02/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-04_20.02/corehq/apps/domain/decorators.py", line 111, in _inner
return call_view()
File "/home/cchq/www/echis/releases/2023-05-04_20.02/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-04_20.02/corehq/apps/app_manager/views/apps.py", line 701, in view_app
return view_generic(request, domain, app_id, release_manager=True)
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/ex-submodules/dimagi/utils/couch/resource_conflict.py", line 20, in new_fn
return fn(*args, **kwargs)
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/app_manager/views/view_generic.py", line 173, in view_generic
context.update(get_releases_context(request, domain, app_id))
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/app_manager/views/releases.py", line 231, in get_releases_context
multimedia_state = app.check_media_state()
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/hqmedia/models.py", line 998, in check_media_state
for media in self.all_media():
File "/home/cchq/www/echis/releases/2023-05-04_20.02/python_env-3.9/lib/python3.9/site-packages/memoized.py", line 20, in _memoized
cache[key] = value = fn(*args, **kwargs)
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/hqmedia/models.py", line 792, in all_media
media.extend(form.all_media(lang=lang))
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/hqmedia/models.py", line 728, in all_media
parsed = self.wrapped_xform()
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/app_manager/models.py", line 1125, in wrapped_xform
return XForm(self.source, domain=self.get_app().domain)
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/app_manager/models.py", line 709, in get
source = app.lazy_fetch_attachment(filename)
File "/home/cchq/www/echis/releases/2023-05-04_20.02/corehq/apps/app_manager/models.py", line 3922, in lazy_fetch_attachment
raise content
couchdbkit.exceptions.ResourceNotFound: LinkedApplication 49a390c8938c90f81c00f0a65d00bc27 attachment: '2b5ad0263e267741a1a9b8e7781761a3bb485f4d.xml'

Thanks,

Hi All

In [1]: from corehq.apps.app_manager.models import Application
   ...:
   ...: app_id = "49a390c8938c90f81c00f0a65d00bc27"
   ...: app = Application.get(app_id)
   ...: forms = [form for form in app.get_forms()]
   ...:
   ...: for form in forms:
   ...:      try:
   ...:          form.wrapped_xform()
   ...:      except Exception:
   ...:          print(f"Bad form is: {form.unique_id}")
   ...:          break
   ...:
Bad form is: 2b5ad0263e267741a1a9b8e7781761a3bb485f4d

'2b5ad0263e267741a1a9b8e7781761a3bb485f4d.xml' is not found in any of the object storage.

Hi, @sirajhassan .

Can you confirm whether or not you can access the form in the upstream application?

Hi @CharlSmit,
The issue is happening on the local server only.

Oh, I see. So this is a remote linked app?

1 Like

Yes,
It is working properly on the staging(cloud) server. The problem is on the local (production) server.

Have you tried relinking the app to the remote app?

Hi Charl,

It is opening the page now. But, the following error is appearing while downloading an app.

ERROR [django.request] Internal Server Error: /downloads/temp/ajax/dl-27ca5c414cab4eb980ae04706f18330a

Thanks,

Hi, @sirajhassan .

What happens when you do the following:

  1. Go to the application settings
  2. Go to "Linked Application" tab
  3. Click "Update"

Do you still get the attachments issue?

Hi Charl,
A new application is generated with message below and it is downloaded with no issue.
"Auto-generated by a phone update. Will expire after next build if not marked released. Generated by user unknown user"

We still get the issue while downloading the previous applications, particularly which were built in March.

Thanks,

I'd recommend to check some basic points. Confirm if the form with the unique ID '2b5ad0263e267741a1a9b8e7781761a3bb485f4d' is accessible in the upstream application. Ensure that the form exists and is properly linked to the application. If it is not accessible, you may need to investigate why the form is missing or not properly linked. Review server configuration. Examine the server configuration for any possible discrepancies between the local server and the staging server. Rebuild or relink the application. Make sure to follow proper procedures and backup any necessary data before performing this action.
found project

Thank you so much @CharlSmit and @Janiir for your kind support. Able to download the new application (recently built).