medic / cht-interoperability

CHT - eCHIS interoperability project
GNU Affero General Public License v3.0
2 stars 3 forks source link

Config changes for OpenHIM to CHT communication #13

Closed njogz closed 1 year ago

njogz commented 1 year ago

Add the required forms and tasks to enable communication between the CHT and the OpenHIM mediator

lorerod commented 1 year ago

@njogz I'm getting: ERROR Webpack warnings when building contact-summary when trying to compile and upload the configuration to my local CHT-core instance.

Environment: MacOS 13.1 (22C65); Docker desktop 4.15.0 (93002)l; Docker engine: 20.10.21 CHT 4.1.0: Local using docker compose files cht-core.yml and cht-couchdb.yml cht version: 3.15.2

Followed the instructions:

  1. Go into the cht-config directory by running cd cht-config.
  2. Run npm install to install the dependencies.
  3. Run cht --url=https://medic:****@****.my.local-ip.co --accept-self-signed-certs

Log:

INFO Checking that https://medic:****@****.my.local-ip.co/medic/ is available... 
(node:2411) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
INFO Processing config in cht-config. 
INFO Actions:
     - check-git
     - compile-app-settings
     - backup-app-settings
     - upload-app-settings
     - convert-app-forms
     - convert-collect-forms
     - convert-contact-forms
     - validate-app-forms
     - validate-collect-forms
     - validate-contact-forms
     - backup-all-forms
     - delete-all-forms
     - upload-app-forms
     - upload-collect-forms
     - upload-contact-forms
     - upload-resources
     - upload-branding
     - upload-partners
     - upload-custom-translations
     - upload-privacy-policies 
INFO Starting action: check-git… 
WARN There are changes in your local branch to be committed or not staged for commit. 
WARN Changes untracked or to be committed:
 M cht-config/package-lock.json

Are you sure you want to continue? [y/n]: y
INFO Fetching git upstream... 
INFO check-git complete. 
INFO Starting action: compile-app-settings… 
WARN app_settings.json file should not be edited directly.
    Please create a base_settings.json file in app_settings folder and move any manually defined configurations there. 
INFO Packaging contact-summary 
INFO Hash: b19913ebf5c6e3563270
Version: webpack 4.46.0
Child
    Hash: b19913ebf5c6e3563270
    Time: 1634ms
    Built at: 02/15/2023 1:00:08 PM
                   Asset    Size  Chunks             Chunk Names
    ./contact-summary.js  68 KiB       0  [emitted]  main
    Entrypoint main = ./contact-summary.js
    [0] ./node_modules/moment/moment.js 147 KiB {0} [built]
    [1] /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/src/contact-summary/lib.js 203 bytes {0} [built]
    [2] ./contact-summary.templated.js 15.8 KiB {0} [built] [1 warning]
    [3] (webpack)/buildin/module.js 497 bytes {0} [built]
    [4] ./contact-summary-extras.js 15.9 KiB {0} [built] [1 warning]
    [5] /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/src/contact-summary/contact-summary-emitter.js 3.41 KiB {0} [built]

    WARNING in ./contact-summary.templated.js
    Module Warning (from /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):
    Failed to load config "@medic" to extend from.
    Referenced from: /Users/marialorenarodriguezviruel/medic-workspace/interoperability/cht-config/.eslintrc
     @ /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60

    WARNING in ./contact-summary-extras.js
    Module Warning (from /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/eslint-loader/dist/cjs.js):
    Failed to load config "@medic" to extend from.
    Referenced from: /Users/marialorenarodriguezviruel/medic-workspace/interoperability/cht-config/.eslintrc
     @ ./contact-summary.templated.js 2:15-50
     @ /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/src/contact-summary/lib.js 
INFO Error: Webpack warnings when building contact-summary
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/src/lib/package-lib.js:103:23
    at finalCallback (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:254:12)
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:277:6
    at done (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/neo-async/async.js:2931:13)
    at runCompilers (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:181:48)
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:188:7
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/MultiCompiler.js:270:7
    at finalCallback (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:257:39)
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:306:14
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:304:22
    at Compiler.emitRecords (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:499:39)
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:298:10
    at /Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/webpack/lib/Compiler.js:485:14
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/marialorenarodriguezviruel/.nvm/versions/node/v16.17.1/lib/node_modules/cht-conf/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1) 
ERROR Webpack warnings when building contact-summary 

Found in the docs this reference to the error and tried the step suggested. The error is still showing.

I also tried to compile and upload /cht-core/config/default, and it was successful. What else can I try?

Phil-Mwago commented 1 year ago

I got this error previously while trying to set up my local environment: See how I resolved it on the forum here.

lorerod commented 1 year ago

@njogz @Phil-Mwago I was able to load the config to my local instance. But not following the README steps. @njogz are you able to load the config following the README steps?

This are the steps I followed:

  1. Created a directory outside the interoperability project
  2. Copied the content of /interoperability/cht-config to the directory created in 1.
  3. Executed cht initialise-project-layout Log:
    
    ERROR Require exactly one of these parameter: --local --instance --url --archive 

NAME cht - Configure your CHT instances

SYNOPSIS cht <--local|--instance=instance-name|--url=url> Or: cht <--local|--instance=instance-name|--url=url|--archive> --

DESCRIPTION This script updates and uploads a project's configuration.

SUPPORTED ACTIONS

SAVE CONFIG TO --local Upload to http://admin:pass@localhost:5988

--instance= Upload to https://admin:password>@<instance-name.medicmobile.org

--user= --instance Upload to https://user-name>:<password>@<instance-name.medicmobile.org

--url= Upload to URL specified.

--archive Save configuration content to files on disk. Requires parameter --destination=.

OPTIONS --help Display this usage message

--shell-completion --shell-completion=bash Generate the shell-completion script for use in bash.

--source=. Defaults to the working directory.

--supported-actions Display a list of supported actions.

--version Display the current version number.

--changelog Display application changelog.

--accept-self-signed-certs Allows cht-conf to work with self signed certs by telling node to ignore the error

--skip-dependency-check Skips checking the version running is set to the same version in the package.json

--skip-git-check Skips checking the status of the current repository that holds the configuration

--skip-translation-check Skips checking message translations

--skip-validate Skips form validation

--force CAN BE DANGEROUS! Passes yes to all commands and any where that would prompt to overwrite changes will overwrite automatically.

INFO Processing config in cht-config. INFO Actions:

andrablaj commented 1 year ago

Here are the errors I encountered and the workarounds I identified in order to upload the config:

  1. By following the steps in the README, I got the same error as @lorerod.
  2. The problem seems to be the node version. I had to switch to v12 (I had v16 locally).
  3. The next error was:
Failed to load config "@medic" to extend from.
Referenced from: /Users/andra/Documents/GitHub/interoperability/cht-config/.eslintrc
 @ /opt/homebrew/lib/node_modules/cht-conf/src/contact-summary/lib.js 1:21-60
  1. I ran cht initialise-project-layout, before thecht --url ... command and got a different error, which seemed connected to es2018:
../.eslintrc:
  Environment key "es2018" is unknown
  1. I changed es2018 to es2020 in the .eslintrc file, and the error changed to:
/Users/andra/Documents/GitHub/interoperability/cht-config/contact-summary.templated.js
  5:3  error  Newline required at end of file but not found  eol-last
  1. I removed the "eol-last": 2, line in the .eslintrc file (or change it to "eol-last": 0,), and the config uploaded without any error.

@njogz @samuelimoisili did you bump into the same problems? If not, is there anything in the steps that I mentioned that is not done correctly, or anything I might have missed?

samuelimoisili commented 1 year ago

@andrablaj Yes, I faced the same issue. I'm creating a new PR to fix the bugs.

andrablaj commented 1 year ago

Thanks, @samuelimoisili. Is there any blocker to perform the fixes via this same branch? I am new to the repo so I might miss something.

lorerod commented 1 year ago

I moved this issue back to In Progress @samuelimoisili. I think it is better for traceability if we continue with this same issue, but it could be in a different PR.

njogz commented 1 year ago

@andrablaj I have merged the fix by @samuelimoisili. Please pull the latest comment on the branch and test again.