Trouble Logging into CHT Locally – “Unexpected error while logging in”

Hi CHT community,

I’ve managed to get the CHT running locally using the cht-docker setup, and I can access the app through http://localhost:5988/. The containers seem to be running fine — CouchDB is up, and I didn’t get any major errors during setup.

I started it using:

COUCHDB_USER=medic COUCHDB_PASSWORD=password docker compose -f docker-compose.yml -f couchdb-override.yml up -d

But when I try to log in with:

  • Username: medic
  • Password: password

I keep getting this message:

Unexpected error while logging in. Please try again.

I’m not sure what’s going wrong here. Do I need to do anything else to initialize the app or the database after starting the containers?

Would really appreciate any help or tips. Thanks so much in advance!

Hey @Najuna_Brian! There are a couple of things to check here. First, just to confirm, were you following these steps to deploy a local CHT development instance (or were you referencing something else)?

Next it would be helpful to know exactly which errors are being recorded in your browser console logs. You can find these on the Console tab of Chrome’s DevTools.

Finally, what are you seeing in the logs being printed by the npm run dev-api command? These are the logs for the API server (where the login logic is executing).

1 Like

@Najuna_Brian As @jkuester suggested, you should check the responses in the browser’s dev tools’ network tab and the logs in the terminal where you are running npm run dev-api. In my experience, this is a case of 429—Too many requests. After loading the login page, in the first startup, this usually happens because the browser needs to request all the resources and there is probably a rate limiter. I usually wait 5-6 seconds after the login page loads before I click login.

4 Likes

Hi @jkuester, thanks for the quick response!

Yes, I was following the steps for deploying a local CHT development instance using cht-docker. I’ll check the browser console logs and also explore the output from npm run dev-api
Appreciate your help!

1 Like

Hi @sugat, thank you for the insight!

That’s really helpful. I wasn’t aware of the rate limiting behavior. I’ll try waiting a few seconds before logging in and also check the network tab and dev-api logs as suggested.

Thank you!

2 Likes