3liz / py-qgis-server

QGIS embbeded WMS/WFS/WCS asynchronous scalable http server
https://docs.3liz.org/py-qgis-server
Mozilla Public License 2.0
68 stars 16 forks source link

'str' object has no attribute 'fileName' when using postgres_handler #23

Closed AsgerPetersen closed 3 years ago

AsgerPetersen commented 3 years ago

When loading project from postgres I get a lot of http 500 errors with the message "Worker internal error". I see this error in the log:

qgis_server_1  | 2021-03-09 07:26:17,914    DEBUG   [40]    RCV b'OWS-SERVER-1': b'\xbd\x06\xe6\xbc\x80\xa8\x11\xeb\xbb`\x02B\xac\x17\x00\x03'
qgis_server_1  | 2021-03-09 07:26:17,915    DEBUG   [40]    Handling request: b'\xbd\x06\xe6\xbc\x80\xa8\x11\xeb\xbb`\x02B\xac\x17\x00\x03'
qgis_server_1  | 2021-03-09 07:26:17,915    DEBUG   [40]    Resolving 'dockerpostgres' protocol
qgis_server_1  | 2021-03-09 07:26:17,915    WARNING [40]    Setting postgres connexion parameters in insecure mode postgres://docker:docker@postgres?sslmode=disable&dbname=qgis&schema=qgis_projekter&project=test1
qgis_server_1  | 2021-03-09 07:26:17,915    DEBUG   [40]    **** Postgresql connection params {'host': 'postgres', 'port': None, 'user': 'docker', 'password': 'docker', 'database': 'qgis', 'sslmode': 'disable'}
qgis_server_1  | 2021-03-09 07:26:17,922    DEBUG   [40]    **** Postgres metadata for 'test1': {'last_modified_time': '2021-03-08T16:22:14+00:00', 'last_modified_user': 'docker'}
qgis_server_1  | 2021-03-09 07:26:17,924    ERROR   [40]    Worker Error 'str' object has no attribute 'fileName'
qgis_server_1  | Traceback (most recent call last):
qgis_server_1  |   File "/usr/local/lib/python3.7/dist-packages/pyqgisserver/zeromq/worker.py", line 158, in run_worker
qgis_server_1  |     handler.handle_message()
qgis_server_1  |   File "/usr/local/lib/python3.7/dist-packages/pyqgisserver/qgsworker.py", line 228, in handle_message
qgis_server_1  |     config_path = project.fileName()
qgis_server_1  | AttributeError: 'str' object has no attribute 'fileName'
qgis_server_1  |
qgis_server_1  | 2021-03-09 07:26:17,925    INFO    [40]    Terminating Worker

I am using the latest docker image: 3liz/qgis-map-server:3.18

dmarteau commented 3 years ago

Thank you for reporting the issue.

This should be fixed with 4e7481f8bb9d0cfa5a8ee7ffb7b6a45d2d867478: there was a variable name collision when looking up for an already cached postgres project.

Fixed images have been released to docker-hub for Qgis 3.16 (ltr) and 3.18 (release)

Please note that py-qgis-server has not be fully tested against Qgis 3.18, if you are looking for something more production ready, stick to the 3.16 version.

AsgerPetersen commented 3 years ago

Tried it out. Works perfectly. Thank you!

dmarteau commented 3 years ago

you're welcome..