Open samijuvaste-exove opened 2 weeks ago
Can confirm this issue with a Postgres DB as well.
After some investigation I've figured out that there is actually an (unhandled) error occurring. Which is:
error: insert into "public"."admin_permissions" ("action", "action_parameters", "conditions", "created_at", "id", "properties", "subject", "updated_at") values ($1, $2, $3, $4, $5, $6, $7, $8) returning "id" - duplicate key value violates unique constraint "admin_permissions_pkey"
at Parser.parseErrorMessage (/Users/boazpoolman/Code/boazpoolman/strapi/strapi-plugin-webtools/playground/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket (/Users/boazpoolman/Code/boazpoolman/strapi/strapi-plugin-webtools/playground/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse (/Users/boazpoolman/Code/boazpoolman/strapi/strapi-plugin-webtools/playground/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket.<anonymous> (/Users/boazpoolman/Code/boazpoolman/strapi/strapi-plugin-webtools/playground/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:488:12)
at addChunk (node:internal/streams/readable:376:12)
at readableAddChunk (node:internal/streams/readable:349:9)
at Readable.push (node:internal/streams/readable:286:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
length: 217,
severity: 'ERROR',
code: '23505',
detail: 'Key (id)=(51) already exists.',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'admin_permissions',
column: undefined,
dataType: undefined,
constraint: 'admin_permissions_pkey',
file: 'nbtinsert.c',
line: '666',
routine: '_bt_check_unique'
}
Even though there is an error, the entry is still created, but a retry will happen because it thought the creation failed. Causing us to end up with two of the same entries. I'm investigating further.
I've reported this as an issue to Strapi core https://github.com/strapi/strapi/issues/21100 as it can be reproduced outside the context of using this plugin
Thanks a lot @boazpoolman . We were figuring also that this might be a core issue in Strapi.
Bug report
Describe the bug
When there are at least three locales in config sync files and a single locale in database, importing configs will result in at least one duplicate locale in database. I couldn't reproduce the bug with sqlite database so this could have something to do with mysql.
Steps to reproduce the behavior
i18n_locale
database table too.Expected behavior
There shouldn't be duplicate locales.
System