Closed 1yuv closed 1 month ago
The .env
vars you used were for a production CHT Core instance in Medic's EKS infra:
COUCHDB_HOST=achham-ne.app.medicmobile.org
COUCHDB_PORT=5984
COUCHDB_SECURE=true
So initially CHT Sync was trying to contact https://achham-ne.app.medicmobile.org:5984
. By commenting out COUCHDB_PORT
node then implicitly uses 443
. so it works. If you had not commented it out and set it to COUCHDB_PORT=443
it would work too.
In the full error log you posted to Slack, it had these additional 5 lines at the end, with an explicit cause
:
2024-10-25 10:39:58 Downloading CouchDB changes feed from 0
2024-10-25 10:41:14 Error getting pending: AxiosError [AggregateError]
2024-10-25 10:41:14 at AxiosError.from (file:///node_modules/axios/lib/core/AxiosError.js:89:14)
2024-10-25 10:41:14 at RedirectableRequest.handleRequestError (file:///node_modules/axios/lib/adapters/http.js:610:25)
2024-10-25 10:41:14 at RedirectableRequest.emit (node:events:519:28)
2024-10-25 10:41:14 at eventHandlers.<computed> (/node_modules/follow-redirects/index.js:38:24)
2024-10-25 10:41:14 at ClientRequest.emit (node:events:519:28)
2024-10-25 10:41:14 at emitErrorEvent (node:_http_client:101:11)
2024-10-25 10:41:14 at TLSSocket.socketErrorListener (node:_http_client:504:5)
2024-10-25 10:41:14 at TLSSocket.emit (node:events:519:28)
2024-10-25 10:41:14 at emitErrorNT (node:internal/streams/destroy:169:8)
2024-10-25 10:41:14 at emitErrorCloseNT (node:internal/streams/destroy:128:3)
2024-10-25 10:41:14 at Axios.request (file:///node_modules/axios/lib/core/Axios.js:45:41)
2024-10-25 10:41:14 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-10-25 10:41:14 at async getPending (file:///src/importer.js:164:15)
2024-10-25 10:41:14 at async importChangesBatch (file:///src/importer.js:139:15)
2024-10-25 10:41:14 at async default (file:///src/importer.js:179:17)
2024-10-25 10:41:14 at async default (file:///src/watcher.js:9:30) {
2024-10-25 10:41:14 cause: AggregateError [ETIMEDOUT]:
2024-10-25 10:41:14 at internalConnectMultiple (node:net:1118:18)
2024-10-25 10:41:14 at afterConnectMultiple (node:net:1685:7) {
2024-10-25 10:41:14 code: 'ETIMEDOUT',
2024-10-25 10:41:14 [errors]: [ [Error], [Error] ]
2024-10-25 10:41:14 }
the ETIMEDOUT
error means it couldn't create a connection per port miss-match above.
I think the code is fine, but that we should call out how to set the port with something like:
Most production CHT Core in Docker and and Kubernetes will need to have the port set to
443
like this:COUCHDB_PORT=443
. This is because you're not using a stand alone CouchDB which runs on the default5984
port as initially declared in theenv.tempolate
file.
@1yuv - we welcome other suggestions for improvements on how to fix this!
If you specify the default COUCHDB_PORT
5984
, while you are working with the production instance, the cht-sync fails citing unclear issues.If you comment out the
COUCHDB_PORT
on the env file, then it would work without any issue.