opencrvs / opencrvs-core

A global solution to civil registration
https://www.opencrvs.org
Other
90 stars 73 forks source link

Create a script for data-seeding in core #5693

Closed Zangetsu101 closed 1 year ago

Zangetsu101 commented 1 year ago

Move the seeding process out of gateway. Client would have a script that starts the seeding process which will enable us to do the validations of the data received from the country. Farajaland would have a github action to use this script

Zangetsu101 commented 1 year ago

when running the seeding process I noticed that openhim consistently throws an error(socket hung up exception) the first time it's run.

Zangetsu101 commented 1 year ago

@euanmillar This is the error from openhim

[0] openhim-core_1     | events.js:377
[0] openhim-core_1     |       throw er; // Unhandled 'error' event
[0] openhim-core_1     |       ^
[0] openhim-core_1     |
[0] openhim-core_1     | TypeError: Cannot read property 'key' of null
[0] openhim-core_1     |     at /usr/src/app/lib/middleware/router.js:245:23
[0] openhim-core_1     |     at handler (/usr/src/app/lib/utils.js:91:14)
[0] openhim-core_1     |     at /usr/src/app/node_modules/mongoose/lib/model.js:5074:18
[0] openhim-core_1     |     at processTicksAndRejections (internal/process/task_queues.js:77:11)
[0] openhim-core_1     |     at runNextTicks (internal/process/task_queues.js:64:3)
[0] openhim-core_1     |     at processImmediate (internal/timers.js:437:9)
[0] openhim-core_1     | Emitted 'error' event on Function instance at:
[0] openhim-core_1     |     at /usr/src/app/node_modules/mongoose/lib/model.js:5076:15
[0] openhim-core_1     |     at processTicksAndRejections (internal/process/task_queues.js:77:11)
[0] openhim-core_1     |     at runNextTicks (internal/process/task_queues.js:64:3)
[0] openhim-core_1     |     at processImmediate (internal/timers.js:437:9)

which results in a fetch error like this:

{"level":50,"time":1691048090628,"pid":17394,"hostname":"tameem-Inspiron-5502","message":"request to http://localhost:5001/fhir/Practitioner failed, reason: socket hang up","type":"system","errno":"ECONNRESET","code":"ECONNRESET","stack":"FetchError: request to http://localhost:5001/fhir/Practitioner failed, reason: socket hang up\n    at ClientRequest.<anonymous> (/home/tameem/projects/opencrvs-core/node_modules/node-fetch/lib/index.js:1491:11)\n    at ClientRequest.emit (node:events:513:28)\n    at ClientRequest.emit (node:domain:489:12)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)","msg":"request to http://localhost:5001/fhir/Practitioner failed, reason: socket hang up"}