Error 500 when trying to destroy OAuth application entry in admin area
Summary
I tried to set up GitLab as OpenID Connect identity provider, but I was unsuccessful (because of gitlab-ce#44332). Now I wanted to delete the entry in Admin Area -> Applications and I'm getting a 500.
Steps to reproduce
- Set up an Application for OpenID Connect in Admin Area -> Applications
- I'm not sure, I guess you need a failed authentication attempt, but the error below should help pinpointing this.
- Try to delete the application entry again.
Actual behavior
HTTP 500 with this in production.log:
ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "oauth_access_grants" violates foreign key constraint "fk_oauth_openid_requests_oauth_access_grants_access_grant_id" on table "oauth_openid_requests"
DETAIL: Key (id)=(95) is still referenced from table "oauth_openid_requests".
: DELETE FROM "oauth_access_grants" WHERE "oauth_access_grants"."application_id" = 13):
app/controllers/admin/applications_controller.rb:42:in `destroy'
lib/gitlab/i18n.rb:51:in `with_locale'
lib/gitlab/i18n.rb:57:in `with_user_locale'
app/controllers/application_controller.rb:362:in `set_locale'
lib/gitlab/middleware/multipart.rb:97:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:17:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/read_only/controller.rb:38:in `call'
lib/gitlab/middleware/read_only.rb:16:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Expected behavior
The entry is deleted.
GitLab version
11.1.1 Omnibus on Ubuntu 16.04, all checks passing