The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_ACLItem_UserID_CMS_User"

Arsénio Ferraz asked on July 21, 2017 18:28

Hi,

I'm having an issue syncing a page from staging to both production server.

SyncServer.ServerError: Exception occurred: [DataConnection.HandleError]: Query: INSERT INTO CMS_ACLItem ([ACLID], [UserID], [RoleID], [Allowed], [Denied], [LastModified], [LastModifiedByUserID], [ACLItemGUID]) VALUES (@ACLID, @UserID, @RoleID, @Allowed, @Denied, @LastModified, @LastModifiedByUserID, @ACLItemGUID); SELECT SCOPE_IDENTITY() AS [ID] Caused exception: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_ACLItem_UserID_CMS_User". The conflict occurred in database "Kentico_PROD-HA-1", table "dbo.CMS_User", column 'UserID'. The statement has been terminated.

Any advice would definitely be appreciated.

Correct Answer

Trevor Fayas answered on July 21, 2017 19:08

The ACLItems is the defining table to determine if they are allowed or not allowed to that page (you can allow/disallow users and roles).

My guess is that the user exists on the staging site but not on the production site. See what users exist on the Security rules for that page in staging, and check to see if those users exist in production.

If not, you can either update the user so it generates the staging task and push, or do a full sync on the users object, but be careful with full sync if your environments have different users, better to just push the 1.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Arsénio Ferraz answered on July 24, 2017 15:20

The user in question is synced and exists in all server with the same userid and objectid.

Could it be something else?

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on July 24, 2017 15:22

Very possible. On the Staging task itself, there's an eyeball icon to view it, and in that information are all the related objects it's trying to pass through.

Can you copy that staging information and paste it somewhere so we can inspect it? There may be other related objects that either don't exist or already exist with the same codename/relationship that's causing an error.

0 votesVote for this answer Mark as a Correct answer

Arsénio Ferraz answered on July 24, 2017 15:43

After investigation all the details, I noticed a strange username there and that was causing the issue. So, your first answer was correct. Thanks for your help.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.