medic / cht-conf

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

medic-conf --instance {project-url-prefix} renders the instance in 502 status #116

Closed mukesh2006 closed 5 years ago

mukesh2006 commented 5 years ago

Instance: http://bss-in.app.medicmobile.org/

Steps to produce:

Conversion complete!
INFO convert-contact-forms complete.
INFO Starting action: backup-all-forms…
ERROR FetchError: invalid json response body at https://bss-in.app.medicmobile.org/medic/ reason: Unexpected token < in JSON at position 0
    at C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\node-fetch\lib\index.js:241:32
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

After this error, the instance starts 502ing, and I'm unable just to upload the app_settings.json using the command medic-conf --instance bss-in.app upload-app-settings fails with following error:

INFO Starting action: upload-app-settings…
ERROR StatusCodeError: 502 - "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.9.11</center>\r\n</body>\r\n</html>\r\n"
    at new StatusCodeError (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request-promise-core\lib\errors.js:32:15)
    at Request.plumbing.callback (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request-promise-core\lib\plumbing.js:104:33)
    at Request.RP$callback [as _callback] (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request-promise-core\lib\plumbing.js:46:31)
    at Request.self.callback (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request\request.js:185:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request\request.js:1161:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (C:\Users\mukes\AppData\Roaming\npm\node_modules\medic-conf\node_modules\request\request.js:1083:12)

@alxndrsn @SCdF @abbyad

dianabarsan commented 5 years ago

@mukesh2006 This happens when uploading standard config from medic-webapp master onto a 2.18 instance?

alxndrsn commented 5 years ago

Can this be closed, or would it be helpful if medic-conf detected this issue and prevented upload of incompatible config?

abbyad commented 5 years ago

What is it that makes that config incompatible in this case?

I don't think we should close the issue until we know what is causing the 502, and can then decide the best way forward.

dianabarsan commented 5 years ago

@abbyad it's the reworked permissions that make the config incompatible.

https://github.com/medic/medic-webapp/issues/3762

abbyad commented 5 years ago

Ah, thanks. In that case it would be nice for medic-conf to detect the incompatible config before uploading.

abbyad commented 5 years ago

@dianabarsan the issue you quoted is 3.4, whereas the original issue is about upgrading to 2.18. Is there another issue related to this one?

dianabarsan commented 5 years ago

@abbyad the issue was about installing the standard config from master (3.4 which includes the change) onto a 2.18 instance.

dianabarsan commented 5 years ago

This is the related issue from medic-projects: https://github.com/medic/medic-projects/issues/5469#issuecomment-443117154

abbyad commented 5 years ago

Ah, thanks for clarifying.

Projects are still pointing to master, although we coincidentally discussed this last week with some teammates to make sure Standard projects point to a released version of the Standard config in their package.json:

        "dependencies": {
          "medic": "git@github.com:medic/medic-webapp.git#3.2.x"
        },

Follow up documentation is coming from that discussion.

mukesh2006 commented 5 years ago

I think it will be helpful if medic-conf detected this issue and prevented uploading incompatible config. @abbyad @alxndrsn

SCdF commented 5 years ago

NB: we have, buried in git history a (incomplete and partially incorrect) settings schema in kanso.json:settings_schema.

My 2c is that we should dredge that up, correct it, and ship it in api. Then medic-conf doesn't need to know what version you're pushing to, and api can validate your config against the correct schema.

garethbowen commented 5 years ago

Here's the issue to "dredge that up": medic/medic-webapp#4783