Couch to PostgreSQL migration fix

I am trying to implement the Couch2Pg set up on my local machine. The instance is running on docker on port 80. And it is accessible. Same case is true for the CouchDB.

Below is what my couch2pg.env looks like:

URL for couch - ensure no trailing slash is present and username and password at the start of the URL

COUCHDB_URL=https://medic:password@localhost/medic

COUCH2PG_SLEEP_MINS=60
COUCH2PG_DOC_LIMIT=1000
COUCH2PG_RETRY_COUNT=5
COUCH2PG_CHANGES_LIMIT=100

COUCH2PG_USER=couch2pg
COUCH2PG_USER_PASSWORD=mypassword

for docker this needs to be postgres, for local calls to “node .” this should be localhost

POSTGRES_SERVER_NAME=localhost
POSTGRES_USER_NAME=couch2pg
POSTGRES_PASSWORD=mypassword
POSTGRES_DB_NAME=cht_new
POSTGRES_PORT=5432

POSTGRESQL_URL=postgres://$COUCH2PG_USER:$COUCH2PG_USER_PASSWORD@$POSTGRES_SERVER_NAME:5432/$POSTGRES_DB_NAME

export POSTGRESQL_URL=postgres://couch2pg:mypassword@localhost:5432/cht_new
export COUCHDB_URL=https://medic:password@localhost/medic
export COUCH2PG_DOC_LIMIT=1000
export COUCH2PG_RETRY_COUNT=5
export COUCH2PG_SLEEP_MINS=120
export COUCH2PG_CHANGES_LIMIT=1000

I am using Postgres 15 with the password encryption set to md5.
When I run the . ./couch2pg.env && node .

Screenshot from 2023-03-27 13-53-07

Is there any configuration I am missing in order to make this work?

Hi @Wycliffe_Owuor , Welcome to CHT forum. From your screenshot, it looks like you’re using the latest version of NodeJS which doesn’t support couch2pg. We’ve this issue open to resolve this problem. For now, can you try using node 12 and see if things work or not?

You may also need to use the lower version of Postgres. We were having some issues with Postgres 14 and we switched to Postgres 12 and it was working.

Hi @Wycliffe_Owuor , Follow up on postgres version supported, If you want to continue using PG 14 or above, you may need to follow up the setps outlined in bullet point 2 [here] (Local Couch2pg Setup | Community Health Toolkit) in the known issues section. Plese let us know how it goes.

Hello, I am on PostgreSQL version 15 and even changing the password encryption settings to MD5 and creating a new user, the issue is still persistent.

Hi @Wycliffe_Owuor , did you also check what node version are you on? I mentioned about latest node versions not supported here. If you are using node 12 and updated encryption to md5 on PG15, what error or prompt are you seeing now?