umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
30 stars 0 forks source link

Issue while adding Umbraco form in Uskinned components #1269

Closed anzalnanazar896 closed 3 months ago

anzalnanazar896 commented 3 months ago

Hello,

I am experiencing an issue with my Uskinned in Umbraco setup where I encounter a UNIQUE KEY constraint violation on the umbracoRelation table. The error message is as follows:

umbracoerror

I have checked the umbracoRelation table and found that there are already two records with the following details:

SELECT * FROM umbracoRelation WHERE parentId = 6367 AND childId = 6365 AND relationType = 6;

One record with relType = 4 and another record with relType = 6

It seems like the system is trying to insert a duplicate key for the relation type 6.

I got the issue while adding Umbraco form inside a Uskinned component.

How can I resolve this issue?

Dark0d3 commented 3 months ago

It appears that the only solution I've discovered to the problem is to drop the constraint, which can fix the problem.

-- Dropping the constraint
ALTER TABLE [umbracoRelation]
DROP CONSTRAINT [IX_umbracoRelation_parentChildType];

-- Re-adding the constraint if needed
ALTER TABLE [umbracoRelation] 
ADD CONSTRAINT [IX_umbracoRelation_parentChildType] 
UNIQUE NONCLUSTERED ([parentId], [childId], [relType]);

maybe someone can mark this as an issue and look into it further

AndyButland commented 3 months ago

That workaround doesn't sound ideal, as the CMS constraint is likely there to protect against duplicate records which it won't be expecting to handle.

I think you will probably have to first take this up with uSkinned please. Maybe they aren't doing anything in particular here with regard to relations but at least they'll be able to verify that it's not caused by some custom code they are running, can provide details of version used and perhaps can provide replication steps in a standard CMS and Forms installation.

I'll keep this open for now in case you or they can provide this further detail.

anzalnanazar896 commented 3 months ago

I have installed Umbraco CMS 12.3.10 and Umbraco Forms 12.2.2. Worked on both standard CMS and Uskinned solution. Again the issue was generated while adding umbraco Forms .

Uskinned Solution

image

Standard CMS

  1. Created a template page Home and a block Form Picker image

  2. Rendered the form inside home page using blocklist.

image

The issue is image

Any solution for this ?

AndyButland commented 3 months ago

OK, I recognise it now as the same issue raised in https://github.com/umbraco/Umbraco.Forms.Issues/issues/1129. You'll see linked from that issue there are some workarounds - you can disable the relation tracking for forms, add an unused form picker to the document or upgrade to Forms 13.

anzalnanazar896 commented 3 months ago

Thank you @AndyButland. It got fixed when added the workaround in the config.