Ali H.Alsaadi
Ali H.Alsaadi

Reputation: 1

Error in running Keycloak MFA Plugins with Keycloak

I was installing all of the MFA Provider Plugins from the Github Repo into Keycloak after adding them to the provider directory, and try to run the app I got the following error stack

2024-10-02 14:36:43,132 ERROR [liquibase.changelog.ChangeSet] (main) ChangeSet META-INF/challenge-changelog.xml::app-auth-challenge::[email protected] encountered an exception.

UPDATE SUMMARY
Run:                          3
Previously run:               0
Filtered out:                 0
-------------------------------
Total change sets:            3

2024-10-02 14:36:43,170 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (development) mode
2024-10-02 14:36:43,170 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to update database
2024-10-02 14:36:43,170 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset META-INF/challenge-changelog.xml::app-auth-challenge::[email protected]:
     Reason: liquibase.exception.DatabaseException: (conn=43) Can't create table `keycloak`.`app_auth_challenge` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE keycloak.app_auth_challenge ADD CONSTRAINT FK_APP_AUTH_CHALLENGE_ON_REALM FOREIGN KEY (realm_id) REFERENCES keycloak.realm (id) ON DELETE CASCADE]
2024-10-02 14:36:43,171 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.MigrationFailedException: Migration failed for changeset META-INF/challenge-changelog.xml::app-auth-challenge::[email protected]:
     Reason: liquibase.exception.DatabaseException: (conn=43) Can't create table `keycloak`.`app_auth_challenge` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE keycloak.app_auth_challenge ADD CONSTRAINT FK_APP_AUTH_CHALLENGE_ON_REALM FOREIGN KEY (realm_id) REFERENCES keycloak.realm (id) ON DELETE CASCADE]
2024-10-02 14:36:43,171 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Migration failed for changeset META-INF/challenge-changelog.xml::app-auth-challenge::[email protected]:
     Reason: liquibase.exception.DatabaseException: (conn=43) Can't create table `keycloak`.`app_auth_challenge` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE keycloak.app_auth_challenge ADD CONSTRAINT FK_APP_AUTH_CHALLENGE_ON_REALM FOREIGN KEY (realm_id) REFERENCES keycloak.realm (id) ON DELETE CASCADE]
2024-10-02 14:36:43,171 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: (conn=43) Can't create table `keycloak`.`app_auth_challenge` (errno: 150 "Foreign key constraint is incorrectly formed") [Failed SQL: (1005) ALTER TABLE keycloak.app_auth_challenge ADD CONSTRAINT FK_APP_AUTH_CHALLENGE_ON_REALM FOREIGN KEY (realm_id) REFERENCES keycloak.realm (id) ON DELETE CASCADE]
2024-10-02 14:36:43,171 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: (conn=43) Can't create table `keycloak`.`app_auth_challenge` (errno: 150 "Foreign key constraint is incorrectly formed")
2024-10-02 14:36:43,171 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

After debugging, I notice the migration file is trying to create an index with the realm instead of REALM table name.

Database Table Structure Image

Here is my system specification:

I tried to change the database table structure but it didn't work.

How do I fix this error?

Upvotes: 0

Views: 41

Answers (0)

Related Questions