question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Database error when trying to delete the `strapi-super-admin` role & an i18n locale at the same time

See original GitHub issue

Bug 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

  1. Go to Config > Config Sync > Tool.
  2. Click on Import.
  3. Look at the toast with the warning.
  4. Go to container logs and find the bug.
  5. Go to Content Management.
  6. Look at some of the models that are missing.
  7. Come back to Config > Config Sync > Tool.
  8. Click on Import again.
  9. Look at a toast with everything working well.
  10. Go back to Content Management.
  11. 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:closed
  • Created a year ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
boazpoolmancommented, Aug 14, 2022

Allright thanks. I’ll try importing locally

1reaction
boazpoolmancommented, Dec 6, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found