craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

[3.x]: Invalid Owner ID exception when trying to get owner of matrix blocks in page #13948

Closed bliswebagency closed 8 months ago

bliswebagency commented 10 months ago

What happened?

Description

On certain pages, trying to query the owner of matrix block using getOwner() function results in 'Invalid Owner ID' exception. The error seems to be relevant when the matrix block is related to a supertable (@engram-design) block (or a child of a supertable).

The issue first became apparent when saving entries, the Scout (studioespresso) plugin would throw an exception re: invalid owner id for a matrix block. We then wrote a simple twig template to verify that the same owner id would throw an exception with a Matrix block query.

Some of these pages are relatively new and were only created and edited within the last few days. But at some point it appears something had occurred which causes the getOwner() to fail with the fields on these pages.

While it has been difficult for us to reproduce, we have created the test below to compare the output between a working page and one where the getOwner() fails

Steps to reproduce

  1. Create new page with contentbuilder that has a matrix field inside a supertable

  2. Client makes multiple edits over a few days to the page

  3. Test the page using the following twig

{#
        check the matrix blocks and their owners
        withOwner=1 to include owner
#}      
{% set id = craft.app.request.getParam('ownerId') %}
{% set withOwner = craft.app.request.getParam('withOwner') %}

{% set matrixBlockQuery = craft.matrixBlocks().limit(999999999).site('*').ownerId(id).allowOwnerDrafts(0).allowOwnerRevisions(0) %}

{{ matrixBlockQuery.total() }} matrix blocks<br />

{% for m in matrixBlockQuery.all() %}
        <br />block id: {{ m.id }} 
        {% if withOwner %}
                {% set owner = m.getOwner() %} --> owner id: {{ owner.id }} 
        {% endif %}
{% endfor %}

Expected behavior

Output of above to show a list of block ids and the owner id, similar to below

3 matrix blocks

block id: 6014784 --> owner id: 4394579 block id: 6014787 --> owner id: 4394579 block id: 6049007 --> owner id: 4394579

Actual behavior

Exception occurs instead

Additional notes:

We found that the supertable for the failing matrix blocks have entries in the elements table. However the supertable element does not seem to have a corresponding entry in the supertableblocks_owners table. eg. if the failing owner id is 4391639 we get this:

mysql> select * from supertableblocks_owners where blockId = '4391639';
Empty set (0.00 sec)

We started noticing this error more frequently after upgrading to Craft 3.8.16 and Supertable 2.7.5.1 eg. pages would seemingly at random end up in this state where getOwner() would fail on specific (but not all) pages.

The Scout (studioespersso) plugin was the first to raise the error as it performs a check with matrix blocks using getOwner(), preventing the users from saving the page!

Disabling Scout temporarily allows the users to save, but when we test the page afterwards the Matrix blocks for that page still fail with calls to getOwner()

Craft CMS version

3.8.16

PHP version

8.0.30

Operating system and version

Linux 4.4.0-1128

Database type and version

MySQL 8.0.28

Image driver and version

GD 8.0.30

Installed plugins and versions

DenyEs commented 9 months ago

Craft 4.5.11.1

I am having the same issue on one of our multisites. I cannot delete certain entries as it comes back with this error

2023-11-29 14:53:51 [web.ERROR] [yii\base\InvalidConfigException] Invalid owner ID: 165849 {"trace":["#0 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/helpers/ElementHelper.php(443): craft\\elements\\MatrixBlock->getOwner()","#1 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/helpers/ElementHelper.php(484): craft\\helpers\\ElementHelper::rootElement(Object(craft\\elements\\MatrixBlock))","#2 /Users/denismekina/Documents/sites/bb/vendor/studioespresso/craft-scout/src/behaviors/SearchableBehavior.php(180): craft\\helpers\\ElementHelper::isDraftOrRevision(Object(craft\\elements\\MatrixBlock))","#3 [internal function]: rias\\scout\\behaviors\\SearchableBehavior->shouldBeSearchable()","#4 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Component.php(297): call_user_func_array(Array, Array)","#5 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/base/Element.php(2223): yii\\base\\Component->__call('shouldBeSearcha...', Array)","#6 /Users/denismekina/Documents/sites/bb/vendor/studioespresso/craft-scout/src/Scout.php(194): craft\\base\\Element->__call('shouldBeSearcha...', Array)","#7 [internal function]: rias\\scout\\Scout->rias\\scout\\{closure}(Object(craft\\events\\DeleteElementEvent))","#8 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\\events\\DeleteElementEvent))","#9 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Component.php(642): yii\\base\\Event::trigger('craft\\\\services\\\\...', 'beforeDeleteEle...', Object(craft\\events\\DeleteElementEvent))","#10 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/services/Elements.php(2058): yii\\base\\Component->trigger('beforeDeleteEle...', Object(craft\\events\\DeleteElementEvent))","#11 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/fields/Matrix.php(1141): craft\\services\\Elements->deleteElement(Object(craft\\elements\\MatrixBlock), false)","#12 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/base/Element.php(5199): craft\\fields\\Matrix->beforeElementDelete(Object(verbb\\supertable\\elements\\SuperTableBlockElement))","#13 /Users/denismekina/Documents/sites/bb/vendor/verbb/super-table/src/elements/SuperTableBlockElement.php(410): craft\\base\\Element->beforeDelete()","#14 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/services/Elements.php(2062): verbb\\supertable\\elements\\SuperTableBlockElement->beforeDelete()","#15 /Users/denismekina/Documents/sites/bb/vendor/verbb/super-table/src/fields/SuperTableField.php(1169): craft\\services\\Elements->deleteElement(Object(verbb\\supertable\\elements\\SuperTableBlockElement), false)","#16 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/base/Element.php(5199): verbb\\supertable\\fields\\SuperTableField->beforeElementDelete(Object(craft\\elements\\Entry))","#17 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/elements/Entry.php(2077): craft\\base\\Element->beforeDelete()","#18 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/services/Elements.php(2062): craft\\elements\\Entry->beforeDelete()","#19 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/elements/actions/Delete.php(191): craft\\services\\Elements->deleteElement(Object(craft\\elements\\Entry), false)","#20 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(259): craft\\elements\\actions\\Delete->performAction(Object(craft\\elements\\db\\EntryQuery))","#21 [internal function]: craft\\controllers\\ElementIndexesController->actionPerformAction()","#22 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)","#23 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)","#24 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('perform-action', Array)","#25 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/web/Application.php(305): yii\\base\\Module->runAction('element-indexes...', Array)","#26 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/web/Application.php(606): craft\\web\\Application->runAction('element-indexes...', Array)","#27 /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/web/Application.php(284): craft\\web\\Application->_processActionRequest(Object(craft\\web\\Request))","#28 /Users/denismekina/Documents/sites/bb/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest(Object(craft\\web\\Request))","#29 /Users/denismekina/Documents/sites/bb/web/index.php(12): yii\\base\\Application->run()","#30 /Users/denismekina/.composer/vendor/laravel/valet/server.php(110): require('/Users/denismek...')","#31 {main}"],"memory":10018376,"exception":"[object] (yii\\base\\InvalidConfigException(code: 0): Invalid owner ID: 165849 at /Users/denismekina/Documents/sites/bb/vendor/craftcms/cms/src/elements/MatrixBlock.php:344)"}

Same as above, if I disable scout or I put the site into dev mode, it works fine, as soon as I enable scout or put site into production mode, I encounter the error again.

brandonkelly commented 9 months ago

Can either of you provide a database backup and Composer files for a site that’s experiencing this issue? If so please send them to support@craftcms.com and point us to where the problem is occurring.

DenyEs commented 9 months ago

Hey @brandonkelly , I have just sent over what you asked for, hope that helps.

bliswebagency commented 9 months ago

Can either of you provide a database backup and Composer files for a site that’s experiencing this issue? If so please send them to support@craftcms.com and point us to where the problem is occurring.

Hi @brandonkelly , thank you for your follow up. I can't provide the original database due to admin's policies but if I can replicate the issue on a test install (with similar field structure, modules, so on) I will try to send this over.

For the time being we have just disabled Scout's automatic update to prevent the exception being thrown whenever a user edits any of the entries affected with this issue.

Hopefully @DenyEs ' db sample will also be able to shed some light. It appears their configuration is similar to the one we are having trouble with.

linear[bot] commented 8 months ago

CMS-1236 Propagate element site deletions to nested elements

brandonkelly commented 8 months ago

We’ve tracked this down to a bug where Matrix blocks aren’t getting deleted when you delete an entry for a single site.

The fix was to get Matrix blocks involved in entry-site deletion, so they can propagate the deletion to their blocks.

A new utils/prune-orphaned-matrix-blocks command was also added, which can be used to clean things up after the issue occurs.

That change was a bit involved, so it was done on the 4.7 branch, which we’re planning to release tomorrow.

(#14154)

DenyEs commented 8 months ago

Awesome! Cheers guys! Will test it as soon as it's released 😊

brandonkelly commented 8 months ago

Craft 4.7.0 is now tagged 🎉

bliswebagency commented 8 months ago

Craft 4.7.0 is now tagged 🎉

Thanks @brandonkelly and @DenyEs !

DenyEs commented 8 months ago

I seems to be having the same issue. After an upgrade to 4.7, I still can't remove an entry from the CMS. So I tried to run php craft utils/prune-orphaned-matrix-blocks/index and that comes back with the following

Finding orphaned matrix blocks for site "First Site" ... none found
Finding orphaned matrix blocks for site "Second Site ... 1435 found
 → Deleting block 143095 in Second Site … ✕
   Error: Invalid owner ID: 95331
i-just commented 8 months ago

@DenyEs, could you disable the Scout plugin, try that command again, re-enable Scout and then check if you’re able to delete the entry that you couldn’t before?

DenyEs commented 8 months ago

After I disabled Scout, the command ran without any issues, I then re-enabled it and deleted an entry which worked fine but when I went to delete another entry - there is one in the database I sent over called "Prospectus - Thank you" that is disabled - I got the same error as before. DIfference is, running the command now returns no orphaned matrix blocks found which is odd.

See the stacktrace below

2024-01-24 10:21:10 [web.ERROR] [yii\base\InvalidConfigException] Invalid owner ID: 52460 {"trace":["#0 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/helpers/ElementHelper.php(443): verbb\\supertable\\elements\\SuperTableBlockElement->getOwner()","#1 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/helpers/ElementHelper.php(484): craft\\helpers\\ElementHelper::rootElement(Object(verbb\\supertable\\elements\\SuperTableBlockElement))","#2 /Users/user/Documents/sites/website/vendor/studioespresso/craft-scout/src/behaviors/SearchableBehavior.php(180): craft\\helpers\\ElementHelper::isDraftOrRevision(Object(verbb\\supertable\\elements\\SuperTableBlockElement))","#3 [internal function]: rias\\scout\\behaviors\\SearchableBehavior->shouldBeSearchable()","#4 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Component.php(297): call_user_func_array(Array, Array)","#5 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/base/Element.php(2223): yii\\base\\Component->__call('shouldBeSearcha...', Array)","#6 /Users/user/Documents/sites/website/vendor/studioespresso/craft-scout/src/Scout.php(194): craft\\base\\Element->__call('shouldBeSearcha...', Array)","#7 [internal function]: rias\\scout\\Scout->rias\\scout\\{closure}(Object(craft\\events\\DeleteElementEvent))","#8 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\\events\\DeleteElementEvent))","#9 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Component.php(642): yii\\base\\Event::trigger('craft\\\\services\\\\...', 'beforeDeleteEle...', Object(craft\\events\\DeleteElementEvent))","#10 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/services/Elements.php(2090): yii\\base\\Component->trigger('beforeDeleteEle...', Object(craft\\events\\DeleteElementEvent))","#11 /Users/user/Documents/sites/website/vendor/verbb/super-table/src/fields/SuperTableField.php(1169): craft\\services\\Elements->deleteElement(Object(verbb\\supertable\\elements\\SuperTableBlockElement), false)","#12 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/base/Element.php(5200): verbb\\supertable\\fields\\SuperTableField->beforeElementDelete(Object(craft\\elements\\Entry))","#13 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/elements/Entry.php(2081): craft\\base\\Element->beforeDelete()","#14 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/services/Elements.php(2094): craft\\elements\\Entry->beforeDelete()","#15 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/elements/actions/Delete.php(191): craft\\services\\Elements->deleteElement(Object(craft\\elements\\Entry), false)","#16 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/controllers/ElementIndexesController.php(259): craft\\elements\\actions\\Delete->performAction(Object(craft\\elements\\db\\EntryQuery))","#17 [internal function]: craft\\controllers\\ElementIndexesController->actionPerformAction()","#18 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)","#19 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)","#20 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('perform-action', Array)","#21 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/web/Application.php(305): yii\\base\\Module->runAction('element-indexes...', Array)","#22 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/web/Application.php(606): craft\\web\\Application->runAction('element-indexes...', Array)","#23 /Users/user/Documents/sites/website/vendor/craftcms/cms/src/web/Application.php(284): craft\\web\\Application->_processActionRequest(Object(craft\\web\\Request))","#24 /Users/user/Documents/sites/website/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest(Object(craft\\web\\Request))","#25 /Users/user/Documents/sites/website/web/index.php(12): yii\\base\\Application->run()","#26 /Users/user/.composer/vendor/laravel/valet/server.php(110): require('/Users/denismek...')","#27 {main}"],"memory":8509152,"exception":"[object] (yii\\base\\InvalidConfigException(code: 0): Invalid owner ID: 52460 at /Users/user/Documents/sites/website/vendor/verbb/super-table/src/elements/SuperTableBlockElement.php:291)"} 
2024-01-24 10:21:10 [web.WARNING] [application] Request context: {"environment":"production","userId":1,"sessionId":"t5aark2ikpvprcj2aodo66nf57","body":"{\"context\":\"index\",\"elementType\":\"craft\\\\elements\\\\Entry\",\"source\":\"section:97ae7079-190f-4937-b169-5770bcc7c589\",\"condition\":null,\"referenceElementId\":null,\"referenceElementSiteId\":null,\"criteria\":{\"siteId\":1,\"search\":\"prospec\",\"offset\":0,\"limit\":100,\"drafts\":null,\"savedDraftsOnly\":true,\"draftOf\":false,\"status\":null},\"disabledElementIds\":[],\"viewState\":{\"mode\":\"table\",\"order\":\"score\",\"sort\":\"desc\"},\"paginated\":1,\"withDescendants\":false,\"hard\":false,\"confirmationMessage\":null,\"successMessage\":null,\"elementAction\":\"craft\\\\elements\\\\actions\\\\Delete\",\"elementIds\":[52460]}","vars":{"_GET":{"p":"bscp/actions/element-indexes/perform-action","site":"bb","v":"1706091670099"},"_FILES":[],"_COOKIE":{"1031b8c41dfff97a311a7ac99863bdc5_username":"ff6b95d20b30f05bef73726d09f2d40aac5e2b5af641ebcb02391c4c8f5dbe39a:2:{i:0;s:41:\"1031b8c41dfff97a311a7ac99863bdc5_username\";i:1;s:9:\"bluestorm\";}","CraftSessionId":"t5aark2ikpvprcj2aodo66nf57","CRAFT_CSRF_TOKEN":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","1031b8c41dfff97a311a7ac99863bdc5_identity":"747a066e47c024d6043801dadf95c92945f1be852858822c17fac60148fa0efea:2:{i:0;s:41:\"1031b8c41dfff97a311a7ac99863bdc5_identity\";i:1;s:159:\"[1,\"[\\\"w1Z82bTCxlsBvRJviiV6IWGW04vN6drGNuK34rS9gtGQYLvjvlAD9HlIFw-i2UUtAnd1FlgNKNXy9rGCK41LjLeonfiGfaIohMKr\\\",null,\\\"71e6151d86a4e774ea496d1f321fcff2\\\"]\",3600]\";}"},"_SESSION":{"bd62416aa8538ede709019a5e113eea5__flash":[],"1031b8c41dfff97a311a7ac99863bdc5__token":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","1031b8c41dfff97a311a7ac99863bdc5__id":1,"__authKey":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","1031b8c41dfff97a311a7ac99863bdc5__expire":1706095270,"__duration":3600,"bd62416aa8538ede709019a5e113eea5__auth_access":["editStructure:1","previewElement:165845","saveAssets:75c58093-7906-4769-b079-803c6c7025b5","saveAssets:c8d31329-ea0d-443c-a82d-896d89b003b2","saveAssets:f9fdfd90-f859-426f-bc11-f7f9bce15bf8"]},"_SERVER":{"PGGSSENCMODE":"disable","LC_ALL":"C","USER":"user","HOME":"/Users/user","HTTP_COOKIE":"1031b8c41dfff97a311a7ac99863bdc5_username=ff6b95d20b30f05bef73726d09f2d40aac5e2b5af641ebcb02391c4c8f5dbe39a%3A2%3A%7Bi%3A0%3Bs%3A41%3A%221031b8c41dfff97a311a7ac99863bdc5_username%22%3Bi%3A1%3Bs%3A9%3A%22bluestorm%22%3B%7D; CraftSessionId=t5aark2ikpvprcj2aodo66nf57; CRAFT_CSRF_TOKEN=d17ed6e30f210475b09c985ea659596d1884cfb1132519f9d58ff1f8280b96caa%3A2%3A%7Bi%3A0%3Bs%3A16%3A%22CRAFT_CSRF_TOKEN%22%3Bi%3A1%3Bs%3A147%3A%22eTM_touOFw-eIHpBNDXe8vI_Epq0bF-mBO2pIBAE%7C97e0565844fc63dad95e40cf47ce3d137d8c31ee7eb49574189621f6551b233feTM_touOFw-eIHpBNDXe8vI_Epq0bF-mBO2pIBAE%7C1%22%3B%7D; 1031b8c41dfff97a311a7ac99863bdc5_identity=747a066e47c024d6043801dadf95c92945f1be852858822c17fac60148fa0efea%3A2%3A%7Bi%3A0%3Bs%3A41%3A%221031b8c41dfff97a311a7ac99863bdc5_identity%22%3Bi%3A1%3Bs%3A159%3A%22%5B1%2C%22%5B%5C%22w1Z82bTCxlsBvRJviiV6IWGW04vN6drGNuK34rS9gtGQYLvjvlAD9HlIFw-i2UUtAnd1FlgNKNXy9rGCK41LjLeonfiGfaIohMKr%5C%22%2Cnull%2C%5C%2271e6151d86a4e774ea496d1f321fcff2%5C%22%5D%22%2C3600%5D%22%3B%7D","HTTP_TE":"trailers","HTTP_SEC_FETCH_SITE":"same-origin","HTTP_SEC_FETCH_MODE":"cors","HTTP_SEC_FETCH_DEST":"empty","HTTP_DNT":"1","HTTP_ORIGIN":"https://bb.test","HTTP_CONTENT_LENGTH":"575","HTTP_X_CSRF_TOKEN":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","HTTP_X_REGISTERED_JS_FILES":"","HTTP_X_REGISTERED_ASSET_BUNDLES":"22e517a2,aee7f8dc,e505ffd6,6b4d7555,e5e48399,bb2f10a0,815d39ea,fc0bc163,1ccab40d,1e21896b,54698ee0,b842675b,1c3c9add,4b1fd285,d8d08e47,8f00ce04,8768f48b,cf3018d6,92d8701","HTTP_X_REQUESTED_WITH":"XMLHttpRequest","HTTP_CONTENT_TYPE":"application/json","HTTP_REFERER":"https://bb.test/bscp/entries/pages?site=bb&source=section%3A97ae7079-190f-4937-b169-5770bcc7c589&search=prospec","HTTP_ACCEPT_ENCODING":"gzip, deflate, br","HTTP_ACCEPT_LANGUAGE":"en-GB,en;q=0.5","HTTP_ACCEPT":"application/json, text/plain, */*","HTTP_USER_AGENT":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) Gecko/20100101 Firefox/121.0","HTTP_HOST":"bb.test","PATH_INFO":"","REDIRECT_STATUS":"200","HTTPS":"on","SERVER_NAME":"bb.test","SERVER_PORT":"443","SERVER_ADDR":"127.0.0.1","REMOTE_PORT":"64969","REMOTE_ADDR":"127.0.0.1","SERVER_SOFTWARE":"nginx/1.25.1","GATEWAY_INTERFACE":"CGI/1.1","SERVER_PROTOCOL":"HTTP/2.0","DOCUMENT_ROOT":"/Users/user/Documents/sites/website/web","DOCUMENT_URI":"/index.php","REQUEST_URI":"/index.php?p=bscp%2Factions%2Felement-indexes%2Fperform-action&site=bb&v=1706091670099","SCRIPT_NAME":"/index.php","SCRIPT_FILENAME":"/Users/user/Documents/sites/website/web/index.php","CONTENT_LENGTH":"575","CONTENT_TYPE":"application/json","REQUEST_METHOD":"POST","QUERY_STRING":"p=bscp%2Factions%2Felement-indexes%2Fperform-action&site=bb&v=1706091670099","FCGI_ROLE":"RESPONDER","PHP_SELF":"/index.php","REQUEST_TIME_FLOAT":1706091670.10334,"REQUEST_TIME":1706091670,"CRAFT_ENVIRONMENT":"production","CRAFT_SECURITY_KEY":"•••••••••••••••••••••••••","CRAFT_DB_DRIVER":"mysql","CRAFT_DB_SERVER":"127.0.0.1","CRAFT_DB_PORT":"3306","CRAFT_DB_DATABASE":"bishop-burton","CRAFT_DB_USER":"root","CRAFT_DB_PASSWORD":"","CRAFT_DB_SCHEMA":"","CRAFT_DB_TABLE_PREFIX":"craft_","AWS_ACCESS_KEY":"••••••••••••••••••••","AWS_SECRET_KEY":"••••••••••••••••••••••••••••••••••••••••","AWS_BUCKET":"bishop-burton","AWS_REGION":"eu-west-2","AWS_CLOUDFRONT_ID":"E7XZTMIL08T87","AWS_CLOUDFRONT_URL":"https://d3f5m0eiwn50nr.cloudfront.net","ALGOLIA_APP_ID":"Z3T8ZB615V","ALGOLIA_SECRET":"••••••••••••••••••••••••••••••••","BB_URL":"https://bb.test","RC_URL":"https://rc.test","FORMIE_SECURITY_KEY":"•••••••••••••••••••••••••","AWS_SES_ENDPOINT":"email-smtp.eu-west-2.amazonaws.com","AWS_SES_PORT":"587","AWS_SES_BB_USERNAME":"AKIA4QTKOVXEVQXPKOFT","AWS_SES_BB_PASSWORD":"••••••••••••••••••••••••••••••••••••••••••••","AWS_SES_RC_USERNAME":"AKIA4QTKOVXE6VZXNDR5","AWS_SES_RC_PASSWORD":"••••••••••••••••••••••••••••••••••••••••••••"}}} 
i-just commented 7 months ago

Trying to delete “Prospectus - Thank you” was giving me an Invalid owner ID: 52532 error. Element 52532 is a SuperTableBlockElement. I PRed the same utility command and fix to the Super Table’s repo. Once merged and released, you should be able to run utils/prune-orphaned-matrix-blocks/index and super-table/utils/prune-orphaned-super-table-blocks commands to get the data cleaned up (with Scout disabled), and then you should be able to delete that entry too. I’ve tested that on your database.

DenyEs commented 7 months ago

Awesome! I will give it a go as soon as it's released. Thank you for an update!

davidwebca commented 7 months ago

I'm currently having "Invalid owner ID" error when pruning revisions in Craft 5 alpha (since early alphas, this error was triggering). Could this be the same problem? Would this command be mergeable in alpha-5.12?

wmdhosting commented 5 months ago

same here in Craft 5 "Invalid owner ID" error when pruning revisions in Craft 5.0.0.

brandonkelly commented 5 months ago

@wmdhosting Could you send a database backup and your Composer files over to support@craftcms.com?