Open johndwells opened 3 years ago
I’ve encountered this too. In our case the issue was that the provisional draft was somehow missing from the elements_sites
table. Don’t know how it happened and haven’t been able to reproduce, but the client was just editing content normally when it suddenly occurred.
The workaround on our end was to create a draft from the provisional draft, and then apply that draft. After that, further provisional drafts for the entry worked normally.
Search for that error in your storage/logs/
folder. If you can find it, can you post the stack trace?
@brandonkelly Here you go:
2021-09-29 18:41:28 [-][1358][6c7c07cc97cdbdeffa5b44e5d68aeee0][error][yii\web\HttpException:404] yii\web\NotFoundHttpException: Draft not found in /var/www/html/vendor/craftcms/cms/src/controllers/EntryRevisionsController.php:436
Stack trace:
#0 [internal function]: craft\controllers\EntryRevisionsController->actionPublishDraft()
#1 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#2 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#3 /var/www/html/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction('publish-draft', Array)
#4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction('publish-draft', Array)
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(277): yii\base\Module->runAction('entry-revisions...', Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(586): craft\web\Application->runAction('entry-revisions...', Array)
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(256): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#8 /var/www/html/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest(Object(craft\web\Request))
#9 /var/www/html/web/index.php(26): yii\base\Application->run()
#10 {main}
OK so just a normal entry-revisions/publish-draft
request.
If this happens again, can you have the user try opening the same Edit Entry page URL in a new browser tab, and see what happens?
@brandonkelly It does happen in another browser tab. I can log in as the user and hit the error repeatedly on every save, in multiple tabs.
Yeah, looks like exactly the same issue we had. If it helps at all, I put in a support ticket about it a few weeks ago; the word back was that the provisional draft was missing from the elements_sites
table, for an unknown reason.
@johndwells Can you try changing your craftcms/cms
requirement in composer.json
to "dev-develop as 3.7.14"
and running composer update
, then running the following command?
php craft utils/repair/section-structure
@brandonkelly Yes, that did appear to fix the "draft not found" issue!
The output of that command had many green checkboxes but at the end had this:
✔ Park House
✖ (First draft) - was missing from structure
✖ (First draft) - was missing from structure
✖ The Glebe (Draft 1) - was missing from structure
✖ (First draft) - was missing from structure
✖ The Glebe (Draft 6) - was missing from structure
✖ Langham Hotel (Draft 1) - was missing from structure
✖ (First draft) - was missing from structure
✖ (First draft) - was missing from structure
✖ (First draft) - was missing from structure
✖ Francis House (Draft 1) - was missing from structure
✖ (First draft) - was missing from structure
✖ (First draft) - was missing from structure
✖ Seven Acres (Draft 2) - was missing from structure
✖ Upper Phillimore Gardens (Draft 1) - was missing from structure
✖ 100 Park Lane (Draft 1) - was missing from structure
✖ (First draft) - was missing from structure
✖ Hampden Road (Draft 1) - was missing from structure
One of those (100 Park Lane, 3 from the bottom) was the particular entry in question that the client was having issue with.
Is the mystery solved then? Is there a workflow/step that our client is doing that we need to advise her against?
Awesome! Had you ever run that command before by chance? We recently discovered a bug where it was removing drafts from the structure (#9868), leading to this sort of error.
@brandonkelly No, we had not run it before (I didn't know it existed until today). IIRC the only commands we've run on this project so far were to occasionally re-save entries (to update URL structures or index newly searchable fields, etc).
This problem came up, I think, through CP user activity alone. The client twice ran into it, but we just don't know what specific steps she did that triggered it.
Well if that command solved it, then the issue was that the element was missing its row in the structureelements
table. Not sure how else that could have happened though. Can you keep an eye out for it and let me know if it comes up again, and what may have been happening right before?
Hi!
I'm also facing this issue now.
Craft version: 3.7.37 PHP version: 7.4.30 Database driver & version: 10.4.20-MariaDB Plugins & versions: "aelvan/imager": "v2.4.0", "aelvan/imager-do-spaces-driver": "1.0.0", "angellco/spoon": "3.6.1", "barrelstrength/sprout-fields": "3.8.5", "born05/craft-assetusage": "^2.2", "craftcms/cms": "3.7.37", "craftcms/commerce": "3.4.7", "craftcms/commerce-stripe": "2.4.2", "craftcms/feed-me": "4.4.0", "craftcms/redactor": "2.8.8", "creativeorange/craft-article": "v1.0.5.1", "diginov/craft-sentry-logger": "1.1.7", "enshrined/svg-sanitize": "~0.15.2", "ether/simplemap": "3.9.2", "ether/tags": "1.0.9", "fruitstudios/linkit": "1.1.12.1", "html2text/html2text": "^4.2", "lewisjenkins/craft-dynamic-fields": "3.0.12", "loilo/fuse": "^6.4", "luwes/craft3-codemirror": "^1.0", "mmikkel/child-me": "1.2.0", "mmikkel/cp-field-inspect": "1.2.5", "mmikkel/incognito-field": "1.2.0", "mmikkel/retcon": "^2.2", "nystudio107/craft-autocomplete": "^1.0", "nystudio107/craft-instantanalytics": "1.1.12", "nystudio107/craft-retour": "3.1.61", "nystudio107/craft-seomatic": "3.4.19", "phpseclib/phpseclib": "^2.0", "putyourlightson/craft-blitz": "3.11.0", "studioespresso/craft-scout": "2.7.2", "utakka/redactor-anchors": "^1.1", "verbb/image-resizer": "2.1.0", "verbb/navigation": "1.4.21", "verbb/super-table": "2.6.8", "verbb/wishlist": "1.4.11", "vlucas/phpdotenv": "^3.4.0", "webonyx/graphql-php": "~14.11.5", "yiisoft/yii2": "~2.0.45.0", "yiisoft/yii2-redis": "^2.0.6"
I've tried the suggested command by @brandonkelly it went through all the entries inside the structure, but didn't solve the issue, faced it again within 2 minutes when I tried to save the entry. Unfortunately this is a new website (for me and my company) and I'm not very familiar with the codebase yet. I just wanted to gave feedback about this happening here as well after reading through this issue.
We are planning to upgrade to Craft 4 soon, could be fixed there? Thanks in advance.
@hatyi If possible, please send a database backup and your composer.json
+ composer.lock
files to support@craftcms.com, and point out which entry/user this is happening for. We can look into it from there.
@hatyi If possible, please send a database backup and your
composer.json
+composer.lock
files to support@craftcms.com, and point out which entry/user this is happening for. We can look into it from there.
Thanks a lot, I'm waiting to get approval from the client and will provide everything you mentioned.
Description
Our client has twice encountered this issue, though we do not know the exact steps to reproduce. This may be related to issue #9868...
Our client has an entry (in a Structure section fwiw) and can click to edit it; however when she clicks save, the error "Draft not found" is displayed. If I log in as a different user, I am able to save the entry fine.
The client's entry has a mix of blue and yellow field markings, signifying there are changes to her draft and also changes to the underlying published version. I do not know if this is related to the underlying cause.
The workaround we have established is that the client must click "Create a draft", and then "Apply draft".
I can supply a DB backup.
Additional info