Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR Invalid Adapter: undefined on form validation #602

Closed
IreneAchola opened this issue Jan 24, 2024 · 11 comments
Closed

ERROR Invalid Adapter: undefined on form validation #602

IreneAchola opened this issue Jan 24, 2024 · 11 comments
Assignees
Labels
released Type: Bug Fix something that isn't working as intended

Comments

@IreneAchola
Copy link
Member

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

  • Instance: any
  • Client platform: MacOS 14.2.1 (23C71)
  • cht-conf version: 3.20.0 to 3.21.2
  • cht-core version: 4.3.2

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

cc @1yuv

@IreneAchola IreneAchola added the Type: Bug Fix something that isn't working as intended label Jan 24, 2024
@garethbowen
Copy link
Member

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

@IreneAchola
Copy link
Member Author

@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 1yuv self-assigned this Jan 24, 2024
@1yuv
Copy link
Member

1yuv commented Jan 24, 2024

Hi @garethbowen , I am working on this.

@1yuv
Copy link
Member

1yuv commented Jan 30, 2024

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

@tatilepizs
Copy link

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. ✅
@1yuv

1yuv added a commit that referenced this issue Jan 31, 2024
fix(#602):  fix errors with validate functions
@medic-ci
Copy link
Collaborator

🎉 This issue has been resolved in version 3.21.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@1yuv
Copy link
Member

1yuv commented Jan 31, 2024

Closing as fixed and released.

@1yuv 1yuv closed this as completed Jan 31, 2024
@freddieptf
Copy link
Contributor

@1yuv the issue described in #602 (comment) is still reproducible. Once we run compile-app-settings and try run tests there's an error

@1yuv
Copy link
Member

1yuv commented Feb 1, 2024

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

@freddieptf
Copy link
Contributor

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Type: Bug Fix something that isn't working as intended
Projects
Status: Done
Development

No branches or pull requests

6 participants