craftcms / cms

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

[4.x]: Changes to the project config are not possible while in read-only mode. #13784

Closed vkamelin closed 11 months ago

vkamelin commented 11 months ago

What happened?

Description

php craft update all

Checking for pending Craft and plugin migrations ...
Total 10 new Craft migrations to be applied:
    - m221027_160703_add_image_transform_fill
    - m221028_130548_add_canonical_id_index
    - m221118_003031_drop_element_fks
    - m230131_120713_asset_indexing_session_new_options
    - m230226_013114_drop_plugin_license_columns
    - m230531_123004_add_entry_type_show_status_field
    - m230607_102049_add_entrytype_slug_translation_columns
    - m230710_162700_element_activity
    - m230820_162023_fix_cache_id_type
    - m230826_094050_fix_session_id_type

*** applying m221027_160703_add_image_transform_fill
    > add column fill string(11) NULL DEFAULT NULL AFTER `interlace` to table {{%imagetransforms}} ... done (time: 0.014s)
    > add column upscale boolean NOT NULL DEFAULT TRUE AFTER `fill` to table {{%imagetransforms}} ... done (time: 0.011s)
    > alter column mode in table {{%imagetransforms}} to enum('stretch','fit','crop','letterbox') NOT NULL DEFAULT 'crop' ... done (time: 0.006s)
Exception: Changes to the project config are not possible while in read-only mode. (.../vendor/craftcms/cms/src/services/ProjectConfig.php:512)
#0 .../vendor/craftcms/cms/src/services/ProjectConfig.php(484): craft\services\ProjectConfig->_setInternal()
#1 .../vendor/craftcms/cms/src/migrations/m221027_160703_add_image_transform_fill.php(59): craft\services\ProjectConfig->set()
#2 .../vendor/craftcms/cms/src/db/Migration.php(49): craft\migrations\m221027_160703_add_image_transform_fill->safeUp()
#3 .../vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(758): craft\db\Migration->up()
#4 .../vendor/craftcms/cms/src/console/controllers/MigrateController.php(361): yii\console\controllers\BaseMigrateController->migrateUp()
#5 [internal function]: craft\console\controllers\MigrateController->actionAll()
#6 .../vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#7 .../vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()
#8 .../vendor/yiisoft/yii2/console/Controller.php(180): yii\base\Controller->runAction()
#9 .../vendor/craftcms/cms/src/console/ControllerTrait.php(90): yii\console\Controller->runAction()
#10 .../vendor/yiisoft/yii2/base/Module.php(552): craft\console\controllers\MigrateController->runAction()
#11 .../vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction()
#12 .../vendor/craftcms/cms/src/console/Application.php(90): yii\console\Application->runAction()
#13 .../vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction()
#14 .../vendor/craftcms/cms/src/console/Application.php(121): yii\console\Application->handleRequest()
#15 .../vendor/yiisoft/yii2/base/Application.php(384): craft\console\Application->handleRequest()
#16 .../craft(13): yii\base\Application->run()
#17 {main}
*** failed to apply m221027_160703_add_image_transform_fill (time: 0.066s)

Steps to reproduce

  1. Run php craft update all

Craft CMS version

4.3.5

PHP version

8.2

Operating system and version

Ubuntu 22.04

Database type and version

MySQL 8.0.34

Image driver and version

No response

Installed plugins and versions

-

vkamelin commented 11 months ago

Anybody here?

brandonkelly commented 11 months ago

This is working as expected.

When admin changes are disallowed (allowAdminChanges is set to false), the project config is intentionally set to read-only.

If you hit that error during a migration, it probably mean that you ran composer update on a dev environment, pushed the composer.lock changes, without actually running the update’s migrations. You should be able to fix it by running php craft up locally, so the same migrations get run there (where admin changes are allowed), and then Git-push and delpoy the updated config/project/* files.