pluginpal/strapi-plugin-config-sync

Admin permissions fail to import

Closed this issue · 9 comments

Firstly, thank you for building this fantastic plugin!

Bug report

Describe the bug

I'm finding that in my production environment admin permissions always fail to import. Other config types are fine. I've tried importing on bootstrap, via CLI and via the GUI. All fail.

Running the import command multiple times doesn't do anything.

Screen Shot 2022-01-21 at 7 43 37 am

The diff is visible in the GUI.

Screen Shot 2022-01-21 at 7 48 21 am

My config

'config-sync': {
    enabled: true,
    config: {
      importOnBootstrap: true,
      excludedConfig: [
        "core-store.plugin_users-permissions_advanced"
      ],
    },
  },

System

  • Node.js version: 12.22.1
  • NPM version: 6.14.12
  • Strapi version: 4.0.5
  • Plugin version: 1.0.0-beta.5
  • Database: Mysql
  • Operating system: Ubuntu 20.4

Hey @danielbitzer,

Thank you for the issue submission!

I think this is an issue with the ordering of the file contents.

Can you confirm in the diff viewer in the GUI that the changes are actually only the order of the data that is different?

So I THINK that if this is an issue of order, I have a fix for it.
You could try it out in your project like so:

yarn add boazpoolman/strapi-plugin-config-sync#pull/43/head
npm install boazpoolman/strapi-plugin-config-sync#pull/43/head

To test:

  • Install PR locally
  • Export config locally
  • Push config to git
  • Pull config to production
  • See if you still have issues with importing

Thanks for looking into this so quickly!

I have tried #43 and initially it seemed to work but then I made a couple of other changes and they don't seem to be importing when they get to production.

Many of the changes in the diff are simply re-ordered. I'm not intentionally re-ordering the fields. This time I've added permissions for one field (abn) and the diff is as follows:

Screen Shot 2022-01-24 at 4 42 13 pm

I'm not quite sure why all the fields keep re-ordering but the changes are not just for re-ordering.

EDIT:

I've updated the PR so that relation entities can be updated.
@danielbitzer Could you test the PR again and see if you can import?

I'm pretty confident that this will solve the issue.

Amazing! That's working great now. Thank you! Do you have a donate link?

Side note: I did encounter a separate issue but I'm not quite sure where the fault was. It may have been Strapi or user error. I made several changes to content type fields and the view config and I was getting the white screen of death for certain config types (in the content manager area, not the content builder). The issue disappeared when I disabled the config-sync plugin. But I was able to resolve the issue by deleting my config sync directory and then doing a fresh export.

Cool! Released with v1.0.0-beta.6.

I haven't set up Github sponsors yet, but you can donate to my PayPal account ❤️
https://www.paypal.com/donate/?hosted_button_id=K2HMAX6DNYY7J

As for the issue you are describing; I've seen somebody who had a similar issue and it turned out to be strapi/strapi#11996.

Otherwise feel free to open another issue 🙂

@danielbitzer Just had contact with another person having this issue.
For him the problem was he had importOnBootstrap enabled locally, which is not recommended.

I'm not sure if that's the issue on your side as wel. But if it is you can do this to resolve it:

config/plugins.js

module.exports = ({ env }) => ({
    'config-sync': {
      enabled: true,
      config: {
        importOnBootstrap: env('NODE_ENV') !== 'development',
      }
    },
});

EDIT:

I've removed the ability to use the importOnBootstrap setting when your Strapi project is the development environment.
That will just fix this issue without any change.

Released with v1.0.0-beta.7

Released with v1.0.0-beta.6.

Great! Thank you!

I've seen somebody who had a similar issue and it turned out to be strapi/strapi#11996.

Interesting, thanks for the pointer.

For him the problem was he had importOnBootstrap enabled locally, which is not recommended.

I literally discovered I'd made this mistake yesterday. I think that's a good change to prevent it happening in the dev environment.

Thank you for the donation @danielbitzer!
Very much appreciated ❤️