medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
23 stars 25 forks source link

latest cht-conf fails to upgrade app settings to latest CHT endpoints #596

Closed 1yuv closed 8 months ago

1yuv commented 8 months ago

Describe the bug cht-conf fails to upgrade valid app-setting to valid endpoint with following error:

INFO Starting action: upload-app-settings… 
INFO TypeError: Invalid Version: null
ERROR Invalid Version: null 

To Reproduce Steps to reproduce the behavior:

  1. Deploy 4.5.0 instance
  2. Prepare valid app settings
  3. Try to upload (cht-conf upload-app-settings) to instance on step 1 with cht-conf 3.19.0 or later
  4. See error

Expected behavior We should be able to upload without any issue

Logs If applicable, include the cht-conf output, server logs, and/or browser logs.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

Additional context This appears to be caused by this feature, which was released on 3.19.0.

This code tries to extract latest api version, which is 4.5.0.6922454971 for 4.5.0 instances and semver considers it invalid version while comparing it with semver.

1yuv commented 8 months ago

This is critical for one of our deployment to have this fixed and deployed, so I'll be working on it.

tatilepizs commented 8 months ago

I was trying to test this ticket but I was not able to reproduce the error in my local environment. I followed the instructions added in the description of the ticket -> here, and the upload is working every time.

I am using:

I tried these two configs:

default config

➜  default git:(4.5.x) ✗ cht --url=https://medic:******@127-0-0-1.local-ip.medicmobile.org:10446 upload-app-settings
INFO Checking that https://medic:****@127-0-0-1.local-ip.medicmobile.org:10446/medic/ is available...
INFO Processing config in default.
INFO Actions:
     - upload-app-settings
INFO Starting action: upload-app-settings…
WARN generate_patient_id_on_people transition is deprecated since 3.8.x. Please use "generate_shortcode_on_contacts" transition instead.
INFO Settings updated successfully
INFO upload-app-settings complete.

gandaki-province - (config suggested by Yuvraj

➜  gandaki-province git:(master) ✗ cht --url=https://medic:*****@127-0-0-1.local-ip.medicmobile.org:10446 upload-app-settings
INFO Checking that https://medic:****@127-0-0-1.local-ip.medicmobile.org:10446/medic/ is available...
INFO Processing config in gandaki-province.
INFO Actions:
     - upload-app-settings
INFO Starting action: upload-app-settings…
INFO Settings updated successfully
INFO upload-app-settings complete.

@1yuv Since this is an important ticket that needs to be released as soon as possible I think that it would be enough if you could add your testing showing the error and then how it was fixed using your branch (596_semver_fix).

Thank you! 😊

1yuv commented 8 months ago

Hi @tatilepizs ,

You can see the failure in current version in these deployments on gandaki and echis ke.

Also, I've attached here the video of failure and pass.

Failing in 3.21.1

https://github.com/medic/cht-conf/assets/6102813/b020020b-0722-4a39-8fa1-f83992404cef

Fix:

https://github.com/medic/cht-conf/assets/6102813/0a3b24ff-d080-4ed2-bb56-7deb7b0a9471

medic-ci commented 8 months ago

:tada: This issue has been resolved in version 3.21.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: