Ballroom-Platform / ballroom-backend

Apache License 2.0
2 stars 8 forks source link

Fail to add admin to the contest. #111

Open daneshk opened 12 months ago

daneshk commented 12 months ago

Fail when trying to add an admin to the contest. It gives the following error in the backend logs,

ballroom-backend-contest-1    | time=2023-09-03T12:59:13.237Z level=ERROR module=ballroom/contest_service message="Error while adding admin to contest" error={"causes":[],"message":"Error while executing batch command starting with: 'INSERT INTO `contestAccess` ( `id`, `contestId`, `userId`, `accessType` ) VALUES ( ? , ? , ? , ? )'.Cannot add or update a child row: a foreign key constraint fails (`ballroomdb`.`contestAccess`, CONSTRAINT `FK_CONTESTACCESS_USER` FOREIGN KEY (`userId`) REFERENCES `User` (`id`)).","detail":{},"stackTrace":[{"callableName":"runBatchInsertQuery","moduleName":"ballerinax.persist.sql.1.SQLClient","fileName":"sql_client.bal","lineNumber":67},{"callableName":"$post$contestaccesses","moduleName":"ballroom.entities.0.Client","fileName":"persist_client.bal","lineNumber":598},{"callableName":"$post$contests$^$users-with-access","moduleName":"ballroom.contest_service.0.$anonType$_0","fileName":"service.bal","lineNumber":474}]}
ManujaDewmina commented 11 months ago

This is because user is not added to the MySQL database user table. In shared contest page we can see all the users in Asgardeo. But In order to give them access we have to add them to our SQL database. When we use centered SQL database user will automatically add into user table after they register.