Web admin returns Server Error (500) while accessing channels


#1

Hello everyone!

In a freshly installed Zato 3.0 on Docker containers, I accessed the web admin, logged in, went to Connections: Outgoing: SQL, added my connection to the PostgreSQL database, then went to Connections: Channels: REST and got a Server Error (500):

2018-10-09 13:30:31,879 DEBG 'zato-server2' stdout output:
2018-10-09 13:30:31,879 - WARNING - 144:DummyThread-23 - zato.server.service:501 - Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'


2018-10-09 13:30:31,880 DEBG 'zato-server2' stdout output:
2018-10-09 13:30:31,880 - WARNING - 144:DummyThread-23 - zato.server.service:516 - Exception in service `zato.cache.builtin.get-list`, e:`Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 505, in update_handle
    response = set_response_func(service, data_format=data_format, transport=transport, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 362, in set_response_data
    response = response.getvalue(serialize=kwargs['serialize'])
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/reqresp/__init__.py", line 405, in getvalue
    elem_value = self._getvalue(name, item, is_sa_namedtuple, is_required, leave_as_is)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/reqresp/__init__.py", line 353, in _getvalue
    raise ZatoException(self.zato_cid, msg)
ZatoException: <ZatoException at 0x7f222530ea50 cid:`7dc2eb0a85ae5a56ae996310`, msg:`Expected elem:[<Integer at 0x7f222e802c90 name:[cache_id]>] not found in item:[{'extend_expiry_on_get': u'', u'name': u'', 'extend_expiry_on_set': u'', 'sync_method': u'', 'cache_type': u'', 'is_active': u'', 'cache_id': u'', 'max_item_size': u'', 'is_default': u'', 'persistent_storage': u'', u'current_size': u'', u'id': u'', 'max_size': u'', 'opaque1': u''}]`>
`

2018-10-09 13:30:31,880 DEBG 'zato-server2' stdout output:
2018-10-09 13:30:31,880 - WARNING - 144:DummyThread-23 - zato.server.service:585 - Could not invoke `zato.cache.builtin.get-list`, e:`Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'

`

2018-10-09 13:30:31,881 DEBG 'zato-server2' stdout output:
2018-10-09 13:30:31,880 - WARNING - 144:DummyThread-23 - zato.server.service:501 - Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'



2018-10-09 13:30:31,881 DEBG 'zato-server2' stdout output:
2018-10-09 13:30:31,881 - ERROR - 144:DummyThread-23 - zato.server.connection.http_soap.channel:324 - Caught an exception, cid:`7dc2eb0a85ae5a56ae996310`, status_code:`500`, _format_exc:`Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'

`

2018-10-09 13:30:31,906 DEBG 'zato-web-admin' stdout output:
2018-10-09 13:30:31,883 - ERROR - 68:MainThread - django.request:284 - Internal Server Error: /zato/http-soap/
Traceback (most recent call last):
  File "/opt/zato/3.0/code/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/zato/3.0/code/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/zato/3.0/code/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/web/views/__init__.py", line 133, in inner_view
    return view(*args, **kwargs)
  File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/web/views/http_soap.py", line 161, in index
    response = req.zato.client.invoke(service_name, {'cluster_id': req.zato.cluster.id})
  File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/middleware.py", line 78, in invoke
    raise Exception('CID: {}\nDetails: {}'.format(zato_env.get('cid'), zato_env.get('details')))
Exception: CID: 7dc2eb0a85ae5a56ae996310
Details: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'

If I go to Connection: Cache: Built-in I get the same error (on screen):

Traceback (most recent call last): File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/web/views/__init__.py", line 375, in __call__ response = self.invoke_admin_service() File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/web/views/__init__.py", line 333, in invoke_admin_service return func(service_name, request) File "/opt/zato/3.0/code/zato-web-admin/src/zato/admin/middleware.py", line 78, in invoke raise Exception('CID: {}\nDetails: {}'.format(zato_env.get('cid'), zato_env.get('details'))) Exception: CID: 98f46cf4648fe30bfe696b3b Details: Traceback (most recent call last): File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch payload, worker_store, self.simple_io_config, post_data, path_info, soap_action) File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle params_priority=channel_item.params_pri) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle self._invoke(service, channel) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke service.handle() File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle response = func(id_, payload, channel, data_format, transport, serialize=True) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name return self.update_handle(*invoke_args, **kwargs) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle raise Exception(exc_formatted) Exception: Traceback (most recent call last): File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle self._invoke(service, channel) File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke service.handle() File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl self.response.payload[:] = elems_with_opaque(self.get_data(session)) File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque return _ElemsWithOpaqueMaker(elems).get() File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get return self._process_elems([], self.elems) File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems elem = bunchify(elem._asdict()) AttributeError: 'CacheBuiltin' object has no attribute '_asdict' 

#2

In case it helps, I was just testing zato enmasse to try to export connections and channels from my PC, then import them in my laptop (same Docker-based installation procedure followed), and I run into this error, which seems to be the same:

$ zato enmasse /opt/zato/env/qs-1/server1/ --export-odb --verbose
Invoking zato.channel.amqp.get-list for channel_amqp
Invoking zato.channel.web-socket.get-list for web_socket
Invoking zato.pubsub.endpoint.get-list for pubsub_endpoint
Invoking zato.channel.jms-wmq.get-list for channel_jms_wmq
Invoking zato.channel.zmq.get-list for channel_zmq
Type def_sec has no 'get-list' service
Invoking zato.http-soap.get-list for http_soap
Invoking zato.scheduler.job.get-list for scheduler
Invoking zato.notif.sql.get-list for notif_sql
Invoking zato.outgoing.amqp.get-list for outconn_amqp
Invoking zato.outgoing.jms-wmq.get-list for outconn_jms_wmq
Invoking zato.query.cassandra.get-list for query_cassandra
Invoking zato.cloud.aws.s3.get-list for cloud_aws_s3
Invoking zato.security.ntlm.get-list for ntlm
Invoking zato.message.json-pointer.get-list for json_pointer
Invoking zato.scheduler.job.get-list for scheduler
Invoking zato.security.apikey.get-list for apikey
Invoking zato.security.basic-auth.get-list for basic_auth
Invoking zato.outgoing.sap.get-list for outconn_sap
Invoking zato.definition.amqp.get-list for def_amqp
Invoking zato.email.smtp.get-list for email_smtp
Invoking zato.security.aws.get-list for aws
Invoking zato.security.vault.connection.get-list for vault_connection
Invoking zato.security.rbac.permission.get-list for rbac_permission
Could not fetch objects of type rbac_permission: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'RBACPermission' object has no attribute '_asdict'


Invoking zato.pubsub.topic.get-list for pubsub_topic
Invoking zato.email.imap.get-list for email_imap
Invoking zato.security.oauth.get-list for oauth
Invoking zato.security.tls.channel.get-list for tls_channel_sec
Invoking zato.cache.builtin.get-list for zato_cache_builtin
Could not fetch objects of type zato_cache_builtin: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'CacheBuiltin' object has no attribute '_asdict'


Invoking zato.definition.cassandra.get-list for def_cassandra
Invoking zato.cloud.openstack.swift.get-list for def_cloud_openstack_swift
Invoking zato.outgoing.stomp.get-list for outconn_stomp
Invoking zato.outgoing.odoo.get-list for outconn_odoo
Invoking zato.generic.connection.get-list for zato_generic_connection
Invoking zato.outgoing.sql.get-list for outconn_sql
Invoking zato.outgoing.zmq.get-list for outconn_zmq
Invoking zato.security.tls.key-cert.get-list for tls_key_cert
Invoking zato.security.rbac.role.get-list for rbac_role
Invoking zato.security.wss.get-list for wss
Invoking zato.definition.jms-wmq.get-list for def_jms_wmq
Invoking zato.search.es.get-list for search_es
Invoking zato.search.solr.get-list for search_solr
Invoking zato.sms.twilio.get-list for zato_sms_twilio
Invoking zato.message.xpath.get-list for xpath
Invoking zato.cache.memcached.get-list for zato_cache_memcached
Invoking zato.notif.cloud.openstack.swift.get-list for notif_cloud_openstack_swift
Invoking zato.outgoing.ftp.get-list for outconn_ftp
Invoking zato.message.namespace.get-list for def_namespace
Invoking zato.security.rbac.role-permission.get-list for rbac_role_permission
Could not fetch objects of type rbac_role_permission: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/internal/service.py", line 311, in handle
    response = func(id_, payload, channel, data_format, transport, serialize=True)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 601, in invoke
    return self.invoke_by_impl_name(self.server.service_store.name_to_impl_name[name], *args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 583, in invoke_by_impl_name
    return self.update_handle(*invoke_args, **kwargs)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 522, in update_handle
    raise Exception(exc_formatted)
Exception: Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 476, in update_handle
    self._invoke(service, channel)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 398, in _invoke
    service.handle()
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/meta.py", line 262, in handle_impl
    self.response.payload[:] = elems_with_opaque(self.get_data(session))
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 159, in elems_with_opaque
    return _ElemsWithOpaqueMaker(elems).get()
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 151, in get
    return self._process_elems([], self.elems)
  File "/opt/zato/3.0/code/zato-common/src/zato/common/util/sql.py", line 130, in _process_elems
    elem = bunchify(elem._asdict())
AttributeError: 'RBACRolePermission' object has no attribute '_asdict'


Invoking zato.channel.stomp.get-list for stomp
Invoking zato.channel.web-socket.get-list for web_socket
Invoking zato.security.jwt.get-list for jwt
Invoking zato.security.xpath.get-list for xpath_sec
Invoking zato.security.tls.ca-cert.get-list for tls_ca_cert
ODB objects read
ODB objects merged in
Data exported to /opt/zato/zato-export-2018-10-09T13_49_17_896071.yml

#3

This was something that I inadvertently introduced yesterday - can you please install the updates and confirm it now?


#4

Yup, it’s working now. Thanks!


#5

I just hot-deployed my first service without compilation errors but, when using curl to call it I am getting the following error:

Procedure followed is this:

  1. Hot-deploy the service:
docker cp genesisng/services/login.py 511a3594b3dc:/opt/zato/env/qs-1/server1/pickup/incoming/services/

The console log seems okay with it, although I am not sure why the tar archive creation appears twice per server:

2018-10-10 16:37:08,834 DEBG 'zato-server2' stdout output:
2018-10-10 16:37:08,834 - INFO - 120:DummyThread-56 - zato.hot-deploy.create:376 - Creating tar archive

2018-10-10 16:37:08,835 DEBG 'zato-server1' stdout output:
2018-10-10 16:37:08,834 - INFO - 119:DummyThread-40 - zato.hot-deploy.create:376 - Creating tar archive

2018-10-10 16:37:08,854 DEBG 'zato-server1' stdout output:
2018-10-10 16:37:08,853 - INFO - 119:DummyThread-40 - zato.hot-deploy.create:376 - Creating tar archive

2018-10-10 16:37:08,855 DEBG 'zato-server2' stdout output:
2018-10-10 16:37:08,855 - INFO - 120:DummyThread-56 - zato.hot-deploy.create:376 - Creating tar archive

2018-10-10 16:37:09,255 DEBG 'zato-server1' stdout output:
2018-10-10 16:37:09,255 - INFO - 119:DummyThread-40 - zato.hot-deploy.create:156 - Uploaded package id:`35`, payload_name:`login.py`

2018-10-10 16:37:09,304 DEBG 'zato-server2' stdout output:
2018-10-10 16:37:09,303 - INFO - 120:DummyThread-56 - zato.hot-deploy.create:156 - Uploaded package id:`35`, payload_name:`login.py`
  1. Call the service using curl:
curl -v -g "http://127.0.0.1:11223/genesisng/logins/1/get"; echo ""

Produces:

2018-10-10 16:40:00,553 DEBG 'zato-server1' stdout output:
2018-10-10 16:40:00,552 - ERROR - 119:DummyThread-44 - zato.server.connection.http_soap.channel:324 - Caught an exception, cid:`4d184002861f8d7c28c1d928`, status_code:`500`, _format_exc:`Traceback (most recent call last):
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 268, in dispatch
    payload, worker_store, self.simple_io_config, post_data, path_info, soap_action)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/connection/http_soap/channel.py", line 502, in handle
    params_priority=channel_item.params_pri)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 443, in update_handle
    wmq_ctx=kwargs.get('wmq_ctx'))
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 944, in update
    service._init(channel_type in _wsgi_channels)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/__init__.py", line 353, in _init
    self.server.encrypt)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/reqresp/__init__.py", line 141, in init
    self.init_flat_sio(cid, sio, data_format, transport, wsgi_environ, required_list)
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/reqresp/__init__.py", line 184, in init_flat_sio
    required_list, use_channel_params_only, path_prefix, default_value, use_text))
  File "/opt/zato/3.0/code/zato-server/src/zato/server/service/reqresp/__init__.py", line 207, in get_params
    for param in params_to_visit:
TypeError: 'Integer' object is not iterable
`

This is the code for the SQLAlchemy schema:

# coding: utf8
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
from .base import Base
from sqlalchemy import Column, Boolean, Integer, String, Index


class Login(Base):
    __tablename__ = 'login'
    __rels__ = []
    __table_args__ = (
        # Trigram GIN indexes for searches (using ILIKE)
        Index('ix_trgm_login_username', 'username', postgresql_using='gin',
              postgresql_ops={'username': 'gin_trgm_ops'}),
        Index('ix_trgm_login_name', 'name', postgresql_using='gin',
              postgresql_ops={'name': 'gin_trgm_ops'}),
        Index('ix_trgm_login_surname', 'surname', postgresql_using='gin',
              postgresql_ops={'surname': 'gin_trgm_ops'}),
    )

    id = Column(Integer, primary_key=True)
    username = Column(String(20), index=True, unique=True, nullable=False)
    password = Column(String(255), nullable=False)
    name = Column(String(50), index=True)
    surname = Column(String(50), index=True)
    email = Column(String(255), index=True, unique=True)
    is_admin = Column(Boolean, default=False)

    def __repr__(self):
        return "<Login(id='%s', username='%s', name='%s', surname='%s', \
                email='%s')>" % (self.id, self.username, self.name,
                                 self.surname, self.email)

And this is the code of the service:

# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
from __future__ import print_function, unicode_literals
from contextlib import closing
from httplib import OK, NO_CONTENT, CREATED, NOT_FOUND, CONFLICT
from zato.server.service import Service, Boolean, Integer, AsIs
from genesisng.schema.login import Login
from sqlalchemy import or_, and_, func
from sqlalchemy.exc import IntegrityError
from urlparse import parse_qs


class Get(Service):
    """Service class to get a login by id."""
    """Channel /genesisng/logins/{id}/get."""

    class SimpleIO:
        input_required = (Integer('id'))
        output_required = ('id', 'username')
        output_optional = ('password', 'name', 'surname', 'email', 'is_admin')
        skip_empty_keys = True

    def handle(self):
        conn = self.user_config.genesisng.database.connection
        id_ = self.request.input.id

        self.logger.info('Executing /genesisng/logins/%s/get' % id_)

        with closing(self.outgoing.sql.get(conn).session()) as session:
            result = session.query(Login).filter(Login.id == id_).one_or_none()

            if result:
                self.response.status_code = OK
                self.response.payload = result
            else:
                self.response.status_code = NOT_FOUND
                self.response.payload = ''

I am not sure whether this might be related to the opening topic of this thread but, since one happened after the other and I am sure they did not happen on my previous installation, they may be related to each other somehow.

Thanks.

P.S. The self.logger.info call never gets executed.


#6

I just found the issue, which seems to be related to using the Integer type on the input id. If I change the service into this:

class Get(Service):
    """Service class to get a login by id."""
    """Channel /genesisng/logins/{id}/get."""

    class SimpleIO:
        input_required = ('id')
        output_required = ('id', 'username')
        output_optional = ('password', 'name', 'surname', 'email', 'is_admin')
        skip_empty_keys = True

It works fine. Is this a bug or a feature? :slight_smile:


#7

This would need to be (Integer('id'),) - that is, a tuple. A list would also do. But you are right that it should just work without such an artificial container.

May I ask that you open a ticket on GH so as not to overlook it?


#8

There are some threads, and also in the docs that describes some features related to this issue.

There is behind the scene magic on the Channel side happening. By having a channel parameter called ‘id’ it automatically maps it into an integer. There are some other keywords as well.
Read here: https://zato.io/docs/progguide/sio.html#datatypes


#9

Indeed. All of this can be configured through config/repo/simple-io.conf file, which exists for each server. One can map one’s own keys to indicate, for instance, that all SimpleIO elements with a suffix of (say) _amount should be converted to integers.


#10

Doh! The tuple! Very true! Sorry, my fault, I had read about it but later forgotten. Thanks!

I’ve opened the ticket nonetheless.


#11

Yes, it was, indeed, already being received as an integer, but I wanted to be more explicit in the code (and also for the sake of trying things out) and completely forgot about the tuple/list thing I read about a few months ago :slight_smile:

Thanks for your reply, @chadical


#12

Ahhh! The extra comma. I’ve seen that in example, and docs… and thought - why is there an extra comma on the end. I’m new to python - and I just learned something.


#13

This is no longer needed, one can now express single element parameter lists as such:

class SimpleIO:
  input_required = 'id'
  output_required = 'user_name'

#14

Tested the new feature and it’s working fine. Also note that it can be expressed like:

class SimpleIO:
    input_required = ('id')
    output_required = ('user_name')

Which is, Python-wise, exactly the same (parenthesis do not turn id or user_name into tuples, but just enclose the value). :slight_smile: