Self-hosted QFieldCloud and uploading projects with sdk.FileTransferType.PROJECT failing

I’m able to sync and push data from/to QGIS and QField to our self-hosted QFieldCloud through

  1. QFieldSync in QGIS (manually)

  2. qfieldcloud-cli with

qfieldcloud-cli -u <user> -p <password> -U https://<server>/api/v1/ create-project --description sdktest --is-private gguf
Creating project gguf…
Created project "<user>/gguf" with project id "<uuid-projectidxx>".

qfieldcloud-cli -u <user> -p <password> -U https://<server>/api/v1/ upload-files <uuid-projectidxx> C:\path_to_\folder_with_\data_and_qgs-file
Uploading files "<uuid-projectidxx>" from C:\path_to_\folder_with_\data_and_qgs-file…
...
Upload finished after uploading 2.

I see the projects created with 1) and 2) in https://<server>/admin. Both have status OK, and I can add project collaborators and I can download the projects in QField and carry out my tasks in the field.

However, now I’m creating 25 different QGIS projects (automatically adding layers and symbols etc. with python) and I want to upload these 25 projects to the self-hosted server through python and not manually 25 times with QFieldSync in QGIS.

I’m trying with

...
newproj = client.create_project(name="skytest",owner="xxxx",description="created with python",is_public=False)
pid=newproj['id']
client.upload_files(pid,sdk.FileTransferType.PROJECT,"S:\path_to_\folder_with_\data_and_qgs-file","*")

When listing the projects (client.list_projects()), the status is set to failed for skytest.
Status failed is confirmed on the admin-site and when trying to download the project in QField, it says “The project does not contain a valid QGIS project file”.

Is my coding wrong and/or can’t I use FileTransferType.PROJECT?
(I found this regarding PACKAGE: Permission denied when uploading gpkg to QFieldCloud using qfieldcloud_sdk · opengisch/QField · Discussion #4050 · GitHub)


Imported from GitHub discussion by @9ls1 on 2024-04-18T16:29:00Z