Crash in app when i open object

Hi,
Today i create much objects in application.
When i try open any object in objects type from list (clicked “eye” on object)
i see in first moment (0,5 sek) object


and a moment later i see:

How it repair?
application stil work because when i open 127.0.0.1:4000 i still logged or when i “try to connect” and “Use connection” i connect and application works.

which is strange some other objects type is work correctly but 3-4 for this moment don’t work and crashes app.
It can’t help restart mongo, rabbit and datagerry
Maybe for it will be helpful that i created 200 public id
Ofcourse today these types worked correctly and i could earlier this day open and view normally objects in type which unfortunately i can’t now

in version 1.1.1 or 1.1.2 i had that problem when i tried export object to format csv but now is good.

where i can to check log what is wrong if i don’t use docker and application works on server?

Ok i find log and see:

Apr 20 11:19:46 127.0.0.1 datagerry: [2020-04-20 11:19:46,708] ERROR in app: Exception on /object/reference/88 [GET]
Apr 20 11:19:46 127.0.0.1 datagerry: Traceback (most recent call last):
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/app.py", line 2292, in wsgi_app
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/app.py", line 1815, in full_dispatch_request
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask_cors/extension.py", line 161, in wrapped_function
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/app.py", line 1718, in handle_user_exception
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/_compat.py", line 35, in reraise
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/app.py", line 1813, in full_dispatch_request
Apr 20 11:19:46 127.0.0.1 datagerry: File "flask/app.py", line 1799, in dispatch_request
Apr 20 11:19:46 127.0.0.1 datagerry: File "cmdb/interface/route_utils.py", line 136, in get_request_user
Apr 20 11:19:46 127.0.0.1 datagerry: File "cmdb/interface/rest_api/framework_routes/object_routes.py", line 399, in get_objects_by_reference
Apr 20 11:19:46 127.0.0.1 datagerry: File "cmdb/framework/cmdb_object_manager.py", line 269, in get_object_references
Apr 20 11:19:46 127.0.0.1 datagerry: File "cmdb/framework/cmdb_type.py", line 136, in get_fields_of_type_with_value
Apr 20 11:19:46 127.0.0.1 datagerry: File "cmdb/framework/cmdb_type.py", line 136, in <listcomp>
Apr 20 11:19:46 127.0.0.1 datagerry: KeyError: 'ref_types'

But now in other type i created next object and i can open it
Can you somehow enable debug mode to know more exactly what happened? because now i can’t open any object in few types.

Which is very strange i can edit these objects and save/ cancel changes but if go to view this object app crashes and open window 127.0.0.1:4000/connect with screen as in first post this topic

Hey @mbatz
today i find error log in log/webserver.error.log:

[2020-04-21 13:08:06][ERROR   ] --- Error handling request /rest/object/reference/85?onlyActiveObjCookie=false (glogging.py)
Traceback (most recent call last):
  File "flask/app.py", line 2292, in wsgi_app
  File "flask/app.py", line 1815, in full_dispatch_request
  File "flask_cors/extension.py", line 161, in wrapped_function
  File "flask/app.py", line 1718, in handle_user_exception
  File "flask/_compat.py", line 35, in reraise
  File "flask/app.py", line 1813, in full_dispatch_request
  File "flask/app.py", line 1799, in dispatch_request
  File "cmdb/interface/route_utils.py", line 136, in get_request_user
  File "cmdb/interface/rest_api/framework_routes/object_routes.py", line 399, in get_objects_by_reference
  File "cmdb/framework/cmdb_object_manager.py", line 269, in get_object_references
  File "cmdb/framework/cmdb_type.py", line 136, in get_fields_of_type_with_value
 File "cmdb/framework/cmdb_type.py", line 136, in <listcomp>
KeyError: 'ref_types'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gunicorn/workers/sync.py", line 135, in handle
  File "gunicorn/workers/sync.py", line 176, in handle_request
  File "cmdb/interface/gunicorn.py", line 131, in __call__
  File "flask/app.py", line 2309, in __call__
  File "flask/app.py", line 2295, in wsgi_app
  File "flask_cors/extension.py", line 161, in wrapped_function
  File "flask/app.py", line 1748, in handle_exception
  File "cmdb/interface/error_handlers.py", line 121, in internal_server_error
AttributeError: 'KeyError' object has no attribute 'description'

Can you help me how this object may not have the attribute described, and how to check exactly which object / attribute is and how to fix it.
Where i have to search bug?

and a litle bigger log when i clicked view object in 5 or 6 types:

	[2020-04-21 14:54:40][ERROR   ] --- Error handling request /rest/object/reference/57?onlyActiveObjCookie=true (glogging.py)
Traceback (most recent call last):
  File "gunicorn/workers/sync.py", line 135, in handle
  File "gunicorn/workers/sync.py", line 176, in handle_request
  File "cmdb/interface/gunicorn.py", line 131, in __call__
  File "flask/app.py", line 2309, in __call__
  File "flask/app.py", line 2295, in wsgi_app
  File "flask_cors/extension.py", line 161, in wrapped_function
  File "flask/app.py", line 1741, in handle_exception
  File "flask/_compat.py", line 35, in reraise
  File "flask/app.py", line 2292, in wsgi_app
  File "flask/app.py", line 1815, in full_dispatch_request
  File "flask_cors/extension.py", line 161, in wrapped_function
  File "flask/app.py", line 1718, in handle_user_exception
  File "flask/_compat.py", line 35, in reraise
  File "flask/app.py", line 1813, in full_dispatch_request
  File "flask/app.py", line 1799, in dispatch_request
  File "cmdb/interface/route_utils.py", line 136, in get_request_user
  File "cmdb/interface/rest_api/framework_routes/object_routes.py", line 399, in get_objects_by_reference
  File "cmdb/framework/cmdb_object_manager.py", line 269, in get_object_references
  File "cmdb/framework/cmdb_type.py", line 136, in get_fields_of_type_with_value
  File "cmdb/framework/cmdb_type.py", line 136, in <listcomp>
KeyError: 'ref_types'

This could not be caused only by the user, because it happens in several different types of objects, and so far it could not be spoiled. Somewhere a internal server error.
If you need more information pls write it to me.

Hi @marcinw,

thanks for reporting that issue. It occurred, if you define an object type with a reference field to a not defined type. We fixed it with version 1.1.5, which we released a few minutes ago. Thanks again for reporting that bug.

Wow its great news @mbatz ,
i update and works perfectly.
What mean “a not defined type” :smile:
Could You explain/ show me in some example how it possible create “a not defined type” because i still don’t know where i could do some mistake in types. :smile: Lastes time i mostly copy types and made small changes.
And in the future I would like not to make mistakes and to complete and create the types of objects correctly.

The issue occurred, if you add a new field of type “Ref” and leave the “Reference type selections” field empty.

It is not really a configuration mistake (although this configuration does not really make sense), but we didn’t handle this situation correctly.

Ok,
so i will check my types and i look for a empty ref fields

I found one field which was empty in reference field. It was not nice, I did not notice and missed the lack of selection of references.
Maybe when you created/ edit some type and have empty reference field:

  1. button “Go to next step” should be grayed out and not clickable until you fill out the field correctly.
  2. if You try click button “Go to next step” should inform some communicate example: “You did not define all fields correctly” and stay on this step on which you was.
  3. this communicate should display when You try click “saved” and do not accept save.

I don’t know where app check data correctness so that’s why get only a suggestion how to prevent similar situations in the future for everyone who will use your software.

That would guard against error