Skip to content

Improve mediator debugging capabilities #158

@andrablaj

Description

@andrablaj

What feature do you want to improve?
Improve mediator debugging capabilities.

Describe the improvement you'd like
@binokaryg and @PrjShrestha have already worked on a solution for a local program that be extended to this repo.

File Changes Instructions
mediator/package.json "watch": "nodemon --watch '**/*.ts' --exec 'node --inspect=0.0.0.0:9229 -r ts-node/register ./index.ts'" add to scripts
docker/docker-compose.mediator.yml - "9229:9229" add to ports
mediator/Dockerfile EXPOSE 9229
CMD ["npm", "run", "watch"]
replace "CMD npm start"
mediator/tsconfig.json "sourceMap": true uncomment/add
.vscode/launch.json {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Docker",
"address": "localhost",
"port": 9229,
"localRoot": "${workspaceFolder}/mediator",
"remoteRoot": "/app",
"protocol": "inspector",
"restart": true,
"skipFiles": ["<node_internals>/**"]
}
]
}
add, create file if needed

After making the change:

  • ./startup.sh up-dev
  • Attach (F5 or click on Attach to Docker)

Troubleshooting

Error: nano(...).use is not a function

Image

  1. Most probably database referenced from nano is not formed properly or url or creds for CHT couchDB are wrong. Check in .env file in mediator and docker-compose.yml files for env variables related to it. Docker first reads the .env file in the same directory as docker-compose.yml then checks in docker-compose.yml inline variables when setting environment variable.
  2. Ensure nano is installed and functioning, check package.json

Error: threw new Error('Mediator Registration Failed: ${err}'); - ECONNREFUSED

Image

  1. Most probably before configurator could finish mediator started. Hence restart configurator then mediator.
  2. Check if interop-user is created and password is correctly set
  3. Go via root and create user and/or reset the password

Error: Mediator Registration Failed: Reason error: User interop@openhim.org not found when authentication with core API

Image

  1. Check if defaults.json is pointing to correct host
       "protocol": "https",
       "host": "openhim.melosic.com",
    
  2. If it is check if the user is registered properly.
  3. Try to setup the user yourself by login in openhim by root
  4. If you cannot login by root as well. There might be a case where while login in you are asked to click on a link to heartbeat during login. Do so. Reapt process 2 to 3.
  5. If none of the above works - talk to @binokaryg

Error: 502 Bad Gateway / Nginx error

  1. Restart SWAG

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions