Okay, I looked into the error logs and found the relevant error:
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_github_user_infos_on_user_id"
DETAIL: Key (user_id)=(13460) already exists.
: INSERT INTO "github_user_infos" ("user_id", "screen_name", "github_user_id", "created_at", "updated_at") VALUES (13460, 'mandihamza', 22196001, '2016-11-07 08:41:11.402380', '2016-11-07 08:41:11.402380') RETURNING "id")
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `exec'
This error pops up when GithubAuthenticator library tries to create a new GithubUserInfo record.
It seems like the github_user_id we are receiving from GitHub is not matching the existing Discourse user record. I will start with looking up the existing GithubUserInfo record:
GithubUserInfo.find_by(user_id: 13460)
And check if the github_user_id is present. If it’s present, find out GitHub account detail of that ID, via this URL:
https://api.github.com/user/<github_user_id>
Try to find out how this ID got linked to mandihamza ![]()
The actual github_user_id for that user is 22196001, and I can verify that from this URL: https://api.github.com/user/22196001
The only solution I can think of here is to delete the existing GithubUserInfo record for that user:
GithubUserInfo.where(user_id: 13460).destroy_all
And ask her to login via GitHub again.