huridocs / uwazi

Uwazi is a web-based, open-source solution for building and sharing document collections
http://www.uwazi.io
MIT License
236 stars 79 forks source link

Can't change any settings: " ValidationError: isMigrationDone" is not allowed","level":"debug" #3062

Closed vasyugan closed 4 years ago

vasyugan commented 4 years ago

When I try to set my instance to public I get the following error:

{"message":"\nurl: /api/settings\nbody: {\n \"site_name\": \"FPIC\",\n \"private\": false,\n \"dateFormat\": \"YYYY/MM/DD\",\n \"mailerConfig\": \"\",\n \"isMigrationDone\": true,\n \"home_page\": \"/page/wgox2hr0gf\",\n \"__v\": 0,\n \"mapTilerKey\": \"QiI1BlAJNMmZagsX5qp7\",\n \"analyticsTrackingId\": \"\",\n \"links\": [],\n \"_id\": \"58ad7d240d44252fee4e6213\",\n \"languages\": [\n {\n \"_id\": \"58ad7d240d44252fee4e6214\",\n \"key\": \"en\",\n \"label\": \"English\",\n \"default\": true\n },\n {\n \"_id\": \"5bf7025befa658001d81eb15\",\n \"label\": \"Spanish\",\n \"key\": \"es\"\n },\n {\n \"_id\": \"5bf702baefa658001d81ebb3\",\n \"key\": \"fr\",\n \"label\": \"French\"\n },\n {\n \"_id\": \"5bf7033aefa658001d81ed8d\",\n \"label\": \"German\",\n \"key\": \"de\"\n }\n ],\n \"filters\": [\n {\n \"_id\": \"5c9a5b06044b3f001f68330b\",\n \"id\": \"ojgdg8goe6i\",\n \"name\": \"Document type\",\n \"items\": [\n {\n \"id\": \"5bbcaa1e64d25906a5143db7\",\n \"name\": \"Protocol\"\n },\n {\n \"id\": \"5c8fb1b373bb98001d8336d8\",\n \"name\": \"Court ruling\"\n },\n {\n \"id\": \"5bbc9eac64d25906a5143da2\",\n \"name\": \"Report\"\n },\n {\n \"id\": \"5bc5deda0f2de66bf6ba9d68\",\n \"name\": \"Guidance\"\n },\n {\n \"id\": \"5bc5de8f0f2de66bf6ba9d5d\",\n \"name\": \"Regulation\"\n },\n {\n \"id\": \"5bbca62d64d25906a5143dae\",\n \"name\": \"Official documents\"\n }\n ]\n },\n {\n \"_id\": \"5c9a5b06044b3f001f68330a\",\n \"id\": \"7osqy0dec8c\",\n \"name\": \"Protocol contents\",\n \"items\": [\n {\n \"id\": \"5c792f10d7a862001df0964a\",\n \"name\": \"Context, purpose and process of protocol creation & maintenance\"\n },\n {\n \"id\": \"5c84e277d7a862001df096c4\",\n \"name\": \"Community governance instruments, structures, territories, history\"\n },\n {\n \"id\": \"5c6bf9c7d7a862001df0919b\",\n \"name\": \"Precondition\"\n },\n {\n \"id\": \"5c84e1a2d7a862001df096a3\",\n \"name\": \"Non-negociables\"\n },\n {\n \"id\": \"5c84e1c3d7a862001df096ae\",\n \"name\": \"Core principles\"\n },\n {\n \"id\": \"5c84e1f0d7a862001df096b9\",\n \"name\": \"Scope of protocol\"\n },\n {\n \"id\": \"5c6bfa12d7a862001df091b1\",\n \"name\": \"Legal frameworks invoked\"\n },\n {\n \"id\": \"5c84e8fad7a862001df09747\",\n \"name\": \"Interfaces with external institutions and organizations\"\n },\n {\n \"id\": \"5c84e9d1d7a862001df09762\",\n \"name\": \"Internal groups or other peoples\"\n },\n {\n \"id\": \"5c84eae8d7a862001df09785\",\n \"name\": \"Scope of consultation\"\n },\n {\n \"id\": \"5c84f2b4d7a862001df0979c\",\n \"name\": \"Who to consult\"\n },\n {\n \"id\": \"5c6d8229d7a862001df0936c\",\n \"name\": \"Roles in decision-making process\"\n },\n {\n \"id\": \"5c88f889d7a862001df097cd\",\n \"name\": \"Conditions for consultation\"\n },\n {\n \"id\": \"5c88fcecd7a862001df09823\",\n \"name\": \"Nature and sequencing of consultation phases\"\n },\n {\n \"id\": \"5c6577a0d7a862001df0093b\",\n \"name\": \"Definition\"\n },\n {\n \"id\": \"5c6d8243d7a862001df09377\",\n \"name\": \"Conditions invalidating consultations\"\n },\n {\n \"id\": \"5c6d825ad7a862001df09382\",\n \"name\": \"When to consult\"\n },\n {\n \"id\": \"5c6d8267d7a862001df0938d\",\n \"name\": \"Outcomes\"\n },\n {\n \"id\": \"5c88ff49d7a862001df0985d\",\n \"name\": \"Actors addressed\"\n }\n ]\n },\n {\n \"_id\": \"5bc72631c4e9f3001e4f05f8\",\n \"id\": \"n2paf396kx9\",\n \"name\": \"Group, person or organisation\",\n \"items\": [\n {\n \"id\": \"5bbcb28064d25906a5143dc4\",\n \"name\": \"Indigenous People\"\n },\n {\n \"id\": \"5bc5ccbc0f2de66bf6ba9d35\",\n \"name\": \"Indigenous Peoples Organisation (IPO)\"\n },\n {\n \"id\": \"5bbe043c5d49fb064c80cb08\",\n \"name\": \"Remedy mechanism\"\n },\n {\n \"id\": \"5bbdba375d49fb064c80cafb\",\n \"name\": \"Company\"\n },\n {\n \"id\": \"5bbe04a25d49fb064c80cb16\",\n \"name\": \"Non-Governmental Organisation\"\n },\n {\n \"id\": \"5bbe0cef5d49fb064c80cb44\",\n \"name\": \"Government body\"\n },\n {\n \"id\": \"5bd2e25a988da7001eedc20f\",\n \"name\": \"Person\"\n }\n ]\n }\n ],\n \"allowedPublicTemplates\": []\n}\nValidationError: \"isMigrationDone\" is not allowed","level":"debug"}

I suspect that the gist is in the end: []\n}\nValidationError: \"isMigrationDone\" is not allowed","level":"debug"} but of course, I don't know how to fix it, so I would say the interface should improve its error reporting because, like that I have no idea what to do.

txau commented 4 years ago

It seems to me that this is related to the fixes in validations that @daneryl has been working on recently.

vasyugan commented 4 years ago

It seems, I can toggle the value in the database manually with no adverse effects.

vasyugan commented 4 years ago

So, this bug also affects other settings. I just tried to change the Matomo configuration and it throws the same error ending in

\"isMigrationDone\" is not allowed","level":"debug"}

daneryl commented 4 years ago

It seems to me that this is related to the fixes in validations that @daneryl has been working on recently.

settings still uses the old validations. i have a PR where the validation on settings are updated to use the new AJV but i do not think that is the issue.

@vasyugan i do not find isMigrationDone in any part of the code is this something you added ? settings section downloads the settings object, then whenever you change something and save it sends everything back, "isMigrationDone" is not allowed by uwazi validation.

vasyugan commented 4 years ago

@vasyugan i do not find isMigrationDone in any part of the code is this something you added ?

No, I yesterday upgraded to Master and that's it. I didn't change or add any code (which would be beyond my ability anyway) and after that ran "yarn migrate" as required.

settings section downloads the settings object, then whenever you change something and save it sends everything back, "isMigrationDone" is not allowed by uwazi validation.

Is this a database entry? The debug message begins: "{"message":"\nurl: /api/settings\nbody: {\n \"site_name\": \"FPIC\",\n \"private\": false,\n \"dateFormat\": \"YYYY/MM/DD\",\n \"mailerConfig\": \"\",\n \"isMigrationDone\": true,\"

daneryl commented 4 years ago

Is this a database entry? The debug message begins: "{"message":"\nurl: /api/settings\nbody: {\n "site_name": "FPIC",\n "private": false,\n "dateFormat": "YYYY/MM/DD",\n "mailerConfig": "",\n "isMigrationDone": true,"

yes this is a database entry, there is a collection "settings" with only one entry, you can modify the settings directly on the DB and remove "isMigrationDone", let me know if that fixes it.

txau commented 4 years ago

@vasyugan @daneryl I also searched the git log for "isMigrationDone" and that string has never been in our code base in previous versions, so I have no idea where is coming from.

Did you run any custom scripts on the database? Maybe to fix some of the previous problems you had.

@vasyugan I think you can just remove it from the database as @daneryl pointed out and you should be ok.

vasyugan commented 4 years ago

@vasyugan @daneryl I also searched the git log for "isMigrationDone" and that string has never been in our code base in previous versions, so I have no idea where is coming from.

Strange.

Did you run any custom scripts on the database? Maybe to fix some of the previous problems you had.

No. I only ever ran Uwazi's scripts.

@vasyugan I think you can just remove it from the database as @daneryl pointed out and you should be ok.

@daneryl I have now deleted the entry and this indeed seems to fix it. Thanks!!!