[BUG] Database error when trying to delete the `strapi-super-admin` role & an i18n locale at the same time
See original GitHub issueBug report
We are testing this plugin in order to avoid additional steps to duplicate our development admin to production.
Importing all the updated files from a previous environment, we found this bug.
[2022-08-13 18:48:57.435] error: error: insert into "admin_permissions" ("action", "conditions", "created_at", "id", "properties", "subject", "updated_at") values ($1, $2, $3, $4, $5, $6, $7) returning "id" - duplicate key value violates unique constraint "admin_permissions_pkey"
Error: error: insert into "admin_permissions" ("action", "conditions", "created_at", "id", "properties", "subject", "updated_at") values ($1, $2, $3, $4, $5, $6, $7) returning "id" - duplicate key value violates unique constraint "admin_permissions_pkey"
at Object.importSingleConfig (/srv/app/node_modules/strapi-plugin-config-sync/server/services/main.js:234:13)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async /srv/app/node_modules/strapi-plugin-config-sync/server/controllers/config.js:57:7
at async Promise.all (index 9)
at async Object.importAll (/srv/app/node_modules/strapi-plugin-config-sync/server/controllers/config.js:56:5)
at async returnBodyMiddleware (/srv/app/node_modules/@strapi/strapi/lib/services/server/compose-endpoint.js:52:18)
at async policiesMiddleware (/srv/app/node_modules/@strapi/strapi/lib/services/server/policy.js:24:5)
at async transform (/srv/app/node_modules/strapi-plugin-transformer/server/middleware/transform.js:9:2)
at async /srv/app/node_modules/@strapi/strapi/lib/middlewares/body.js:51:9
at async /srv/app/node_modules/@strapi/strapi/lib/middlewares/logger.js:22:5
at async /srv/app/node_modules/@strapi/strapi/lib/middlewares/powered-by.js:16:5
at async cors (/srv/app/node_modules/@koa/cors/index.js:95:16)
at async /srv/app/node_modules/@strapi/strapi/lib/middlewares/errors.js:13:7
at async session (/srv/app/node_modules/koa-session/index.js:41:7)
at async /srv/app/node_modules/@strapi/strapi/lib/services/metrics/middleware.js:29:5
Steps to reproduce the behavior
- Go to Config > Config Sync > Tool.
- Click on Import.
- Look at the toast with the warning.
- Go to container logs and find the bug.
- Go to Content Management.
- Look at some of the models that are missing.
- Come back to Config > Config Sync > Tool.
- Click on Import again.
- Look at a toast with everything working well.
- Go back to Content Management.
- Find the missing models on the admin.
Expected behavior
It would not show any problem at importing configuration.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
If applicable, add code samples to help explain your problem.
System
- Node.js version: 4.3.2 (node v14.20.0)
- Strapi version: 4.3.2
- Plugin version: 2.0.8
- Database: PostgreSQL 13.7
- Operating system: Alpine Linux v3.16
Additional context
Add any other context about the problem here.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
Can't use translation file for en-US: "An i18n locale ... - GitHub
bug report I can't use a translation file for en-US: i18n": { "locales": ... However our app is very big and we want...
Read more >Internationalization (i18n) - Strapi Developer Docs
On a fresh i18n plugin installation, en is set as default locale. If the database does not contain any locale, and no ...
Read more >What Is i18n? | Introduction to Internationalization - Lingoport
i18n is the process of preparing software so that it can support local languages, cultural settings, & meet the requirements of local markets....
Read more >Translations (Symfony Docs)
The term "internationalization" (often abbreviated i18n) refers to the process of abstracting strings and other locale-specific pieces out of your ...
Read more >perllocale - Perl locale handling (internationalization and ...
Perl was extended to support the locale system. This is controlled per application by using one pragma, one function call, and several environment...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Allright thanks. I’ll try importing locally
I’ve written an exception to forbid deletion of the super-admin role which will fix this problem. See commit.
This was released with v1.1.0 of the plugin.