Steps to reproduce:
1. Create a resource.
2. Enable it.
3. Disable it.
4. Change it's "id" in RestResource annotations section.
5. Clear cache.
6. Go to /admin/people/permissions.
7. See the error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "{MY OLD REST RESOURCE ID}" plugin does not exist.
Workaround
From Comment #9
1. drush config-export --yes
2. Find in your config folder yml file rest.resource.{YOUR_RESOURCE_NAME} and delete it.
3. drush config-import --yes
4. drush cache-rebuild
for sure, and error will miss.
My workaround has been:
1. Go to "config" table.
2. Search for a value in "name" column with id: "rest.resource.{MY OLD REST RESOURCE ID}".
3. Delete it.
Comments
Comment #2
Wim LeersRenaming a REST resource plugin ID is not allowed while configuration is referring to it. The proper way to do this is:
Comment #3
bdominguez CreditAttribution: bdominguez commentedBut how I "Delete REST resource config" without doing it directly in database manually?
Comment #4
Wim LeersIf you uninstall the module that provides the REST resource plugin, you'll also have to uninstall the configuration that depends on it.
Therefore:
Comment #5
bdominguez CreditAttribution: bdominguez commentedOk, but sometimes you can't uninstall a module because you already have a configuration, schema, etc... attached and you will lose it.
I think that it would help other people to see my workaround and apply it in that cases.
Thanks.
Comment #6
Wim LeersYes, your suggested work-around is how somebody who knows his way around Drupal's innards would do it. :)
Comment #7
clemens.tolboomComment #8
Wim LeersComment #9
NiklanA workaround for those who will find it later.
1.
drush cex -y
actual configs.2. Find in your config folder yml file
rest.resource.{YOUR_RESOURCE_NAME}
and delete it.3.
drush cim -y
this change, it will be correctly removed from DB.4.
drush cr
for sure, and error will miss.Comment #10
Wim LeersThanks, @Niklan!
Comment #11
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedThis solution works, thank you.
But the situation that I should act like this is awful. It's really not obvious and very inconvenient. I expect that if I disabled the resource and will remove the file where I defined it (not a config file) I will not get an error when I'll want to clear cache.
Comment #12
druplr CreditAttribution: druplr commentedI did as explained in #9, but import failed with an error. But
drush cdel rest.resource.{YOUR_RESOURCE_NAME}
worked for me.Comment #13
clemens.tolboomGuess we could add a page somewhere.
Looking at links below I even wonder how to even "create a resource" ... is that documented somewhere or just wade through the API docs?
- https://www.drupal.org/docs/8/core/modules/rest
- https://www.drupal.org/docs/8/api/restful-web-services-api
Comment #14
Wim LeersYes, it's documented, see https://www.drupal.org/docs/8/api/restful-web-services-api/restful-web-s..., .
Comment #15
clemens.tolboomAdded #9 to summary.
I keep this open as a reminder to edit mentioned page (it uses dl,dd,dt in strange way)
Comment #16
clemens.tolboomThat's not going to work ... edit that page. Un-assigning and closing.
Comment #17
tjtj CreditAttribution: tjtj commentedI get a zillion error messages when I try to import the configuration like:
Comment #18
clemens.tolboomThis has nothing to do with Rest UI but ...
suggests to manual enable the analytic module ... I get this annoyance not and then with other modules. I suspect myself adding too many modules and config changes Drupal gets in troubled waters.
Comment #19
MahmoudSayed96Thanks, @druplr #12 works for me