Skip to content

[5.10]: Migration error when upgrading from 5.9.x to 5.10.x caused by Webhooks plugin #103

Description

@schlagmichdoch

What happened?

Description

When upgrading Craft from 5.9.x to 5.10.x there is a migration error with the m260401_155236_min_authors_setting migration.
I could upgrade all packages apart from Craft via the craft update but got a migration error.

Upon recognizing that the Webhooks plugin was mentioned in the error message explicitly (/var/www/html/vendor/craftcms/webhooks/src/Plugin.php) I deinstalled it and tried to upgrade again to 5.10.9 which then worked. Afterwards, I could install the Webhooks plugin again.

Steps to reproduce

  1. Install Craft 5.9.23
  2. Install Webhooks Plugin and add data
  3. Try to upgrade Craft to 5.10.9

Expected behavior

Upgrade to run without errors

Actual behavior

$ ddev craft update craft:5.10.3
Fetching available updates ... done
Performing one update:                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                    
    - craft 5.9.23 => 5.10.3                                                                                                                                                                                                                        

Create database backup? (yes|no) [yes]:yes
Backing up the database ... done
Performing update with Composer ... done                                                                                                                                                                                                            
Applying new migrations ... error: The command "'/usr/bin/php8.3' '/var/www/html/craft' 'migrate/all' '--no-backup' '--no-content'" failed.                                                                                                         
                                                                                                                                                                                                                                                    
Exit Code: 1(General error)                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                    
Working directory: /var/www/html                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    
Output:                                                                                                                                                                                                                                             
================                                                                                                                                                                                                                                    
Checking for pending Craft and plugin migrations ...                                                                                                                                                                                                
Total 1 new Craft migration to be applied:                                                                                                                                                                                                          
    - m260401_155236_min_authors_setting                                                                                                                                                                                                            
                                                                                                                                                                                                                                                    
*** applying m260401_155236_min_authors_setting                                                                                                                                                                                                     
    > add column minAuthors smallint UNSIGNED NOT NULL DEFAULT 1 AFTER `enableVersioning` to table {{%sections}} ... done (time: 0.020s)                                                                                                            
Exception: craft\web\View::renderSandboxedString(): Argument craftcms/cms#1 ($template) must be of type string, null given, called in /var/www/html/vendor/craftcms/webhooks/src/Plugin.php on line 222 (/var/www/html/vendor/craftcms/cms/src/web/View.php:726)
#0 /var/www/html/vendor/craftcms/webhooks/src/Plugin.php(222): craft\web\View->renderSandboxedString()                                                                                                                                              
craftcms/cms#1 [internal function]: craft\webhooks\Plugin->craft\webhooks\{closure}()                                                                                                                                                                           
craftcms/cms#2 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()                                                                                                                                                                          
craftcms/cms#3 /var/www/html/vendor/yiisoft/yii2/base/Component.php(657): yii\base\Event::trigger()                                                                                                                                                             
craftcms/cms#4 /var/www/html/vendor/craftcms/cms/src/base/Element.php(6740): yii\base\Component->trigger()                                                                                                                                                      
craftcms/cms#5 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(3127): craft\base\Element->afterSave()                                                                                                                                                  
craftcms/cms#6 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(4168): craft\elements\Entry->afterSave()                                                                                                                                             
craftcms/cms#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1270): craft\services\Elements->craft\services\{closure}()                                                                                                                           
craftcms/cms#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3945): craft\services\Elements->ensureBulkOp()                                                                                                                                       
craftcms/cms#9 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1356): craft\services\Elements->_saveElementInternal()                                                                                                                               
craftcms/cms#10 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(1043): craft\services\Elements->saveElement()                                                                                                                                        
craftcms/cms#11 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(891): craft\services\Entries->_ensureSingleEntry()                                                                                                                                   
craftcms/cms#12 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1868): craft\services\Entries->handleChangedSection()                                                                                                                           
craftcms/cms#13 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1184): craft\console\Application->craft\base\{closure}()                                                                                                                       
craftcms/cms#14 [internal function]: craft\services\ProjectConfig->handleChangeEvent()                                                                                                                                                                          
craftcms/cms#15 /var/www/html/vendor/yiisoft/yii2/base/Component.php(648): call_user_func()                                                                                                                                                                     
craftcms/cms#16 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(85): yii\base\Component->trigger()                                                                                                                                           
craftcms/cms#17 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(568): craft\models\ProjectConfigData->commitChanges()                                                                                                                          
craftcms/cms#18 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(528): craft\services\ProjectConfig->_setInternal()                                                                                                                             
craftcms/cms#19 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(608): craft\services\ProjectConfig->set()                                                                                                                                            
craftcms/cms#20 /var/www/html/vendor/craftcms/cms/src/migrations/m260401_155236_min_authors_setting.php(29): craft\services\Entries->saveSection()                                                                                                              
craftcms/cms#21 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\migrations\m260401_155236_min_authors_setting->safeUp()                                                                                                                       
craftcms/cms#22 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(765): craft\db\Migration->up()                                                                                                                                  
craftcms/cms#23 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(365): yii\console\controllers\BaseMigrateController->migrateUp()                                                                                                
craftcms/cms#24 [internal function]: craft\console\controllers\MigrateController->actionAll()                                                                                                                                                                   
#25 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(60): call_user_func_array()                                                                                                                                                             
#26 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(182): yii\base\InlineAction->runWithParams()                                                                                                                                              
#27 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(187): yii\base\Controller->runAction()                                                                                                                                                 
#28 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(190): yii\console\Controller->runAction()                                                                                                                       
#29 /var/www/html/vendor/yiisoft/yii2/base/Module.php(547): craft\console\controllers\MigrateController->runAction()                                                                                                                                
#30 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()                                                                                                                                                    
#31 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction()                                                                                                                                         
#32 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()                                                                                                                                          
#33 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest()                                                                                                                                    
#34 /var/www/html/vendor/yiisoft/yii2/base/Application.php(382): craft\console\Application->handleRequest()                                                                                                                                         
#35 /var/www/html/craft(13): yii\base\Application->run()                                                                                                                                                                                            
#36 {main}                                                                                                                                                                                                                                          
*** failed to apply m260401_155236_min_authors_setting (time: 0.453s)                                                                                                                                                                               
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    
0 from 1 migrations were applied.                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                    
Migration failed. The rest of the migrations are canceled.                                                                                                                                                                                          
                                                                                                                                                                                                                                                    
Restore a database backup before trying again.                                                                                                                                                                                                      
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    
Error Output:                                                                                                                                                                                                                                       
================                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                    
Output:                                                                                                                                                                                                                                             

Checking for pending Craft and plugin migrations ...
Total 1 new Craft migration to be applied:
    - m260401_155236_min_authors_setting

*** applying m260401_155236_min_authors_setting
    > add column minAuthors smallint UNSIGNED NOT NULL DEFAULT 1 AFTER `enableVersioning` to table {{%sections}} ... done (time: 0.020s)
Exception: craft\web\View::renderSandboxedString(): Argument craftcms/cms#1 ($template) must be of type string, null given, called in /var/www/html/vendor/craftcms/webhooks/src/Plugin.php on line 222 (/var/www/html/vendor/craftcms/cms/src/web/View.php:726)
#0 /var/www/html/vendor/craftcms/webhooks/src/Plugin.php(222): craft\web\View->renderSandboxedString()
craftcms/cms#1 [internal function]: craft\webhooks\Plugin->craft\webhooks\{closure}()
craftcms/cms#2 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func()
craftcms/cms#3 /var/www/html/vendor/yiisoft/yii2/base/Component.php(657): yii\base\Event::trigger()
craftcms/cms#4 /var/www/html/vendor/craftcms/cms/src/base/Element.php(6740): yii\base\Component->trigger()
craftcms/cms#5 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(3127): craft\base\Element->afterSave()
craftcms/cms#6 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(4168): craft\elements\Entry->afterSave()
craftcms/cms#7 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1270): craft\services\Elements->craft\services\{closure}()
craftcms/cms#8 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(3945): craft\services\Elements->ensureBulkOp()
craftcms/cms#9 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(1356): craft\services\Elements->_saveElementInternal()
craftcms/cms#10 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(1043): craft\services\Elements->saveElement()
craftcms/cms#11 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(891): craft\services\Entries->_ensureSingleEntry()
craftcms/cms#12 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1868): craft\services\Entries->handleChangedSection()
craftcms/cms#13 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(1184): craft\console\Application->craft\base\{closure}()
craftcms/cms#14 [internal function]: craft\services\ProjectConfig->handleChangeEvent()
craftcms/cms#15 /var/www/html/vendor/yiisoft/yii2/base/Component.php(648): call_user_func()
craftcms/cms#16 /var/www/html/vendor/craftcms/cms/src/models/ProjectConfigData.php(85): yii\base\Component->trigger()
craftcms/cms#17 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(568): craft\models\ProjectConfigData->commitChanges()
craftcms/cms#18 /var/www/html/vendor/craftcms/cms/src/services/ProjectConfig.php(528): craft\services\ProjectConfig->_setInternal()
craftcms/cms#19 /var/www/html/vendor/craftcms/cms/src/services/Entries.php(608): craft\services\ProjectConfig->set()
craftcms/cms#20 /var/www/html/vendor/craftcms/cms/src/migrations/m260401_155236_min_authors_setting.php(29): craft\services\Entries->saveSection()
craftcms/cms#21 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): craft\migrations\m260401_155236_min_authors_setting->safeUp()
craftcms/cms#22 /var/www/html/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(765): craft\db\Migration->up()
craftcms/cms#23 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(365): yii\console\controllers\BaseMigrateController->migrateUp()
craftcms/cms#24 [internal function]: craft\console\controllers\MigrateController->actionAll()
#25 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(60): call_user_func_array()
#26 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(182): yii\base\InlineAction->runWithParams()
#27 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(187): yii\base\Controller->runAction()
#28 /var/www/html/vendor/craftcms/cms/src/console/controllers/MigrateController.php(190): yii\console\Controller->runAction()
#29 /var/www/html/vendor/yiisoft/yii2/base/Module.php(547): craft\console\controllers\MigrateController->runAction()
#30 /var/www/html/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#31 /var/www/html/vendor/craftcms/cms/src/console/Application.php(91): yii\console\Application->runAction()
#32 /var/www/html/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()
#33 /var/www/html/vendor/craftcms/cms/src/console/Application.php(122): yii\console\Application->handleRequest()
#34 /var/www/html/vendor/yiisoft/yii2/base/Application.php(382): craft\console\Application->handleRequest()
#35 /var/www/html/craft(13): yii\base\Application->run()
#36 {main}
*** failed to apply m260401_155236_min_authors_setting (time: 0.453s)


0 from 1 migrations were applied.

Migration failed. The rest of the migrations are canceled.

Restore a database backup before trying again.



Restore the database backup? (yes|no) [yes]:yes
Restoring the database backup ... done
Revert the Composer changes? (yes|no) [yes]:yes                                                                                                                                                                                                     
Reverting Composer changes ... done
                                                                                                                                                                                                                                                    
Failed to run craft update craft:5.10.3: exit status 1

Craft CMS version

5.9.23

PHP version

8.3.30

Operating system and version

Linux 6.17.0-40-generic

Database type and version

MySQL 8.0.40

Image driver and version

Imagick 3.8.1 (ImageMagick 7.1.1-43)

Installed plugins and versions

  • Asset Usage 4.2.1
  • BlurHash 3.0.6
  • CKEditor 5.5.0
  • Contact Form 3.1.0
  • Contact Form Extended 1.0.3
  • Contact Form Extensions 5.0.0
  • Contact Form Honeypot 2.1.0
  • Expanded Singles 3.0.3
  • Multi Translator 2.28.3
  • Prefetch 3.0.0
  • Pwny 1.0.2
  • Recentchanges 3.0.3
  • Searchable 2.0.2
  • SEOMate 3.3.1
  • Translation Helper 1.0.11
  • Vite 5.0.1
  • Webhooks 3.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions