Login not verified 500 Internal Server Error

OK, I have been facing the exact same situation, which turned out to be caused by my external URLs not being reachable from the containers (because my DNS were not yet up).

Specifically, when enabling debug logs, this call was failing with a DNS lookup error (from kpi/kpi/deployment_backends/kc_access/utils.py):

def _trigger_kc_profile_creation(user):
"""
Get the user's profile via the KC API, causing KC to create a KC
UserProfile if none exists already
"""
url = settings.KOBOCAT_URL + '/api/v1/user'
token, _ = Token.objects.get_or_create(user=user)
response = requests.get(
    url, headers={'Authorization': 'Token ' + token.key})
if not response.status_code == 200:
    raise KobocatProfileException(
        'Bad HTTP status code `{}` when retrieving KoBoCAT user profile'
        ' for `{}`.'.format(response.status_code, user.username))
return response

I’m not sure why in this case kpi seems to be trying to call kobocat using the external URL, but that was the issue…

The solution in my case was:

  • Either to make sure external URLs were up
  • As a workaround in dev, I’ve added a DNS resolution in the containers to resove the external domain to localhost. But this will only work if the scheme is the same (http/https) between internal and external urls
1 Like