Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle duplicate env error / unique key constraint issue #5674

Merged
merged 5 commits into from
Jan 17, 2023

Conversation

jackkav
Copy link
Contributor

@jackkav jackkav commented Jan 13, 2023

changelog(Fixes): Fixed an issue where importing would sometimes result in a duplicate environment error / unique key constraint issue

Motivation
trying to import collections and getting unique key id violation error

the error occurs when find env line returns empty and reruns ensure children
ensure children run getOrCreateForParentId which should get the base env but instead attempts to create a new base env which because its id is derived from the parentId throws the unique key error

this change so far may not fix the issue but it should raise the reproducability.

Closes INS-2269
Closes #5617 #5677

@filfreire filfreire changed the title pretty sure this will help Handle duplicate env error / unique key constraint issue Jan 13, 2023
@jackkav jackkav requested a review from gatzjames January 13, 2023 22:11
@filfreire filfreire force-pushed the fix/save-the-children branch 2 times, most recently from 5927754 to baaa380 Compare January 16, 2023 10:33
@filfreire
Copy link
Member

@jackkav this still doesn't fix it, but I have a simple repro path:

  • Create a collection A
  • Export collection to file, like fromA.yaml
  • Create a collection B
  • Import fromA.yaml inside collection B

image

Happens regardless if the export is of collection or entire workspace - that collection than becomes damaged always.

Throws the error folks are mentioning in #5617

@jackkav
Copy link
Contributor Author

jackkav commented Jan 17, 2023

Might be worth making an e2e test to cover this case for after we fix it.

@jackkav jackkav force-pushed the fix/save-the-children branch from baaa380 to d337622 Compare January 17, 2023 10:49
@filfreire filfreire force-pushed the fix/save-the-children branch from 63828c6 to 9ceb3e9 Compare January 17, 2023 14:23
@filfreire filfreire merged commit fc51f7a into Kong:develop Jan 17, 2023
@jackkav jackkav deleted the fix/save-the-children branch January 17, 2023 17:40
@lipecss
Copy link

lipecss commented Sep 22, 2023

im still getting this
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate environment variables leads to Key Error, unusable UI
3 participants