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

ERROR Invalid Adapter: undefined on form validation #602

Closed IreneAchola closed 10 months ago

IreneAchola commented 10 months ago

Important: This is a public repository. Anyone in the world can see what's posted here. If you are posting screenshots or log files, please carefully examine them for the presence of any kind of protected health information (PHI). Images or logs containing PHI must be posted in fully-redacted form, with no visible PHI.

Describe the bug Running validate-app-forms or validate-contact-forms causes ERROR Invalid Adapter: undefined

To Reproduce Steps to reproduce the behavior:

  1. Go to a project
  2. Run cht -- validate-app-forms
  3. See error
  4. Run cht -- validate-contact-forms
  5. See error

Expected behavior The forms are validated without errors

Logs

INFO Actions:
     - validate-app-forms
     - validate-contact-forms 
INFO Starting action: validate-app-forms… 
INFO Error: Invalid Adapter: undefined
    at new PouchDB (/usr/local/lib/node_modules/cht-conf/node_modules/pouchdb-core/lib/index.js:1297:11)
    at module.exports (/usr/local/lib/node_modules/cht-conf/src/lib/db.js:13:10)
    at getApiVersion (/usr/local/lib/node_modules/cht-conf/src/lib/get-api-version.js:13:24)
    at async getValidApiVersion (/usr/local/lib/node_modules/cht-conf/src/lib/get-api-version.js:21:37)
    at async module.exports (/usr/local/lib/node_modules/cht-conf/src/lib/validate-forms.js:47:41)
    at async module.exports (/usr/local/lib/node_modules/cht-conf/src/lib/main.js:193:5)
    at async /usr/local/lib/node_modules/cht-conf/src/bin/index.js:16:5 
ERROR Invalid Adapter: undefined 

Environment

Additional context Only fails with the validate forms modules. Adding --skip-validate flag to cht --url=yoururl command does not produce errors.

cc @1yuv

garethbowen commented 10 months ago

@IreneAchola If you install cht-conf 3.19 or earlier does it work?

IreneAchola commented 10 months ago

@garethbowen yes, it works on 3.19.0 and 3.18.3. Although 3.19.0 gives these errors with test harness.


...ll(e,r,r+=t));return n}function vn(e,t){return e._chain?W(t).chain():t}function yn(e){return Ot(ce(e),(function(t){var n=W[t]=e[t];W.prototype[t]=function(){var e=[this._wrapped];return i.o.apply(e,arguments),vn(this,n.apply(W,e))}})),W}Ot(['pop','push','reverse','shift','sort','splice','unshift'],(function(e){var t=i.a[e];W.prototype[e]=function(){var n=this._wrapped;return null!=n&&(t.apply(n,arguments),'shift'!==e&&'splice'!==e||0!==n.length||delete n[0]),vn(this,n)}})),Ot(['concat','join','slice'],(function(e){var t=i.a[e];W.prototype[e]=function(){var e=this._wrapped;return null!=e&&(e=t.apply(e,arguments)),vn(this,e)}}));var wn=W,In=yn(r);In._=In;var Tn=In}]);
      at parse (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:85365:19)
      at Object.exports.parse (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:85372:5)
      at Object.exports.parseRuleSet (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:85325:27)
      at Object.exports.parse (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:79653:19)
      at parse (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:81430:23)
      at Object.exports.compile (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:81461:16)
      at Object.initialize (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:90859:20)
      at Object.initialize (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:90351:36)
      at Object.initialize (node_modules/cht-conf-test-harness/dist/all-chts-bundle.dev.js:90056:48)
      at prepareRulesEngine (node_modules/cht-conf-test-harness/src/core-adapter.js:88:23)
1yuv commented 10 months ago

Hi @garethbowen , I am working on this.

1yuv commented 10 months ago

Hi @medic/quality-assurance , this is ready for QA on branch 602.

tatilepizs commented 10 months ago

Thank you @IreneAchola for the steps to reproduce added in the description, it was very useful and easy to follow ⭐

Test details

Config: Default Environment: Local with docker helper script cht-core version: master (~4.5.0)


Reproducible on cht-conf version 3.21.1

Using the following command it was really easy to reproduce the error.

 cht --url=https://medic:password@127-0-0-1.local-ip.medicmobile.org:10446 validate-app-forms validate-contact-forms

image

Fixed on cht-conf branch 602 -> branch's link

Using the same command in the same cht-core environment the test passed successfully.

 cht --url=https://medic:password@127-0-0-1.local-ip.medicmobile.org:10446 validate-app-forms validate-contact-forms

image


Test passed successfully. :white_check_mark: @1yuv

medic-ci commented 10 months ago

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

The release is available on:

Your semantic-release bot :package::rocket:

1yuv commented 10 months ago

Closing as fixed and released.

freddieptf commented 10 months ago

@1yuv the issue described in https://github.com/medic/cht-conf/issues/602#issuecomment-1907800255 is still reproducible. Once we run compile-app-settings and try run tests there's an error

1yuv commented 10 months ago

@freddieptf , Does it mean there were two different issues in two different versions?

freddieptf commented 10 months ago

Not really sure as this could either be a bug here or in the test harness, all i can tell is the test harness errors when we try and run tests.

IreneAchola commented 10 months ago

@freddieptf I found that the error was addressed in https://github.com/medic/cht-conf-test-harness/issues/243, so updating the test harness fixed the issue.