pluginpal/strapi-plugin-config-sync

Error trying to export

Closed this issue · 4 comments

Bug report

Describe the bug

When Trying to export from the GUI a change made to the user roles, the GUI displayed both an error message and a success message, and in the logs there is an error

Steps to reproduce the behavior

  1. Go to Users & Permission Plugin, make a change on a role for a content-type
  2. Go to config-sync plugin and clich "Export" (see screenshot)
  3. Click "Yes, export" in the confirmation popup
  4. See error (see screenshot)

Expected behavior

Only the success message should appear

Screenshots

2022-01-17_11-53

Schermata da 2022-01-17 11-54-42

Code snippets

This is the error in the logs:

[2022-01-17 11:42:40.494] error: TypeError: Cannot read properties of undefined (reading 'type')
Error: TypeError: Cannot read properties of undefined (reading 'type')
    at Object.exportSingleConfig (/srv/app/node_modules/strapi-plugin-config-sync/server/services/main.js:252:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /srv/app/node_modules/strapi-plugin-config-sync/server/controllers/config.js:22:9
    at async Promise.all (index 0)
    at async Object.exportAll (/srv/app/node_modules/strapi-plugin-config-sync/server/controllers/config.js:21:7)
    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 /srv/app/node_modules/@strapi/strapi/lib/middlewares/body.js:24:7
    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

System

  • Node.js version: v16.13.0
  • Strapi version: 4.0.4
  • Plugin version: 1.0.0-beta.4
  • Operating system: bullseye

Additional context

The "importOnBootstrap" option is used

Hey @emillo,

I was unable to replicate the issue.
Can you confirm a couple of things with me:

  • Does it work when you try to export from the CLI?
  • If you just delete the entire config/sync/ folder and export everything again. Do you still have the issue?
  • If you turn off the importOnBootstrap setting. Do you still have the issue?

Hello @boazpoolman

  1. If I try to export from CLI it says that there are no changes to export although there is one.
  2. If I delete the config/sync folder and do Make the initial export everything seems to go well but I get the error in the GUI saying Warning: an error occurred and no error in the logs
  3. If I disable the importOnBootstrap setting the observable behaviour from the GUI is the same, but got no error in logs: on further inspection it seems that the error in the logs appears only if you click a second time on the Export button (because after the first it shows that there are still differences, but this seems to be false: so the GUI is not in sync with the state)

So the CLI says no changes.
I think you are right; the GUI is not in sync with the actual state.

This must be some kind of edgecase because I can't reproduce it.

If you, or somebody else having this issue, finds a solution for it I'd be happy to merge it.

@boazpoolman the culprit was the setting watchIgnoreFiles in config/admin.js that was still pointing to the old dir structure :

watchIgnoreFiles: ["**/config-sync/files/**"]

changed it to

watchIgnoreFiles: ['**/config/sync/**']

solved the problem

Thanks