verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
94 stars 72 forks source link

Updating CraftCMS from 4.4.17 to ^5.0.0 and Formie from 2.0.34.1 to ^3.0 #2009

Closed romainpoirier closed 1 month ago

romainpoirier commented 1 month ago

Describe the bug

I am attempting to update a project from "craftcms/cms": "4.4.17" to "craftcms/cms": "^5.0.0". Initially, I was using "verbb/formie": "2.0.34.1", and the migration to Craft 5 seems to require "verbb/formie": "^3.0".

However, when I visit the front-end of the site, I encounter the following error:

yii\web\HttpException: You must be on Formie 2.1.5 at least to manually update to Formie 3.0.0. in /var/www/html/vendor/craftcms/cms/src/services/Plugins.php:250
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1589): craft\services\Plugins->loadPlugins()
#1 /var/www/html/vendor/craftcms/cms/src/web/Application.php(110): craft\web\Application->_postInit()
#2 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#3 /var/www/html/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array)
#4 [internal function]: yii\base\Application->__construct(Array)
#5 /var/www/html/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array)
#6 /var/www/html/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#7 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#8 /var/www/html/vendor/craftcms/cms/src/Craft.php(70): yii\BaseYii::createObject(Array, Array)
#9 /var/www/html/vendor/craftcms/cms/bootstrap/bootstrap.php(316): Craft::createObject(Array)
#10 /var/www/html/vendor/craftcms/cms/bootstrap/web.php(40): require('/var/www/html/v...')
#11 /var/www/html/htdocs/index.php(11): require('/var/www/html/v...')
#12 {main}

When I update my composer.json to "verbb/formie": "2.1.5", I encounter the following error:

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - verbb/formie 2.1.5 requires craftcms/cms ^4.3.2 -> found craftcms/cms[4.3.2, ..., 4.10.8] but it conflicts with your root composer.json require (^5.0.0).
    - Root composer.json requires verbb/formie 2.1.5 -> satisfiable by verbb/formie[2.1.5].

Failed to execute command php -d memory_limit=-1 /usr/local/bin/composer install: exit status 2

Steps to reproduce

  1. Attempt to update composer.json with "craftcms/cms": "^5.0.0" and "verbb/formie": "^3.0".
  2. Visit the front-end of the site and observe the error.
  3. Modify composer.json to "verbb/formie": "2.1.5".
  4. Run composer install and observe the error.

Form settings

Craft CMS version

4.4.17 (attempting to update to ^5.0.0)

Plugin version

2.0.34.1 (attempting to update to ^3.0)

Multi-site?

No response

Additional context

No response

engram-design commented 1 month ago

It's correct that you need to update to Formie 2.1.5 (at least) in order to upgrade to Formie 3 for Craft 5.

Sounds like your craftcms/cms constraint is still set to 5.0?

Typically, before any major Craft version upgrade, it's a good idea to run composer update and ensure that all your packages are using a loose version constraint like ^4.x.x and not 4.2.5 for example.

romainpoirier commented 1 month ago

I have updated my composer.json as follows:

"require": {
    "craftcms/ckeditor": "^4.1.0",
    "craftcms/cms": "^5.0.0",
    "doublesecretagency/craft-cpcss": "^3.0.0",
    "enovatedesign/craft-style-inliner": "^4.1.1",
    "ether/simplemap": "^5.0.1",
    "mmikkel/cp-field-inspect": "^2.0.2",
    "mmikkel/retcon": "^3.2.0",
    "nystudio107/craft-emptycoalesce": "^5.0.0",
    "nystudio107/craft-minify": "^5.0.0",
    "nystudio107/craft-typogrify": "^5.0.1",
    "perfectwebteam/craft-mailchimp-transactional": "^2.1.0",
    "putyourlightson/craft-dashboard-begone": "^3.0.0",
    "putyourlightson/craft-sprig": "^3.2.0",
    "spacecatninja/imager-x": "^5.0.1",
    "spicyweb/craft-embedded-assets": "^5.1.1",
    "spicyweb/craft-neo": "^5.1.3",
    "studioespresso/craft-dumper": "^5.0.1",
    "verbb/expanded-singles": "^3.0.0",
    "verbb/formie": "^2.1.5",
    "vlucas/phpdotenv": "^5.4.0"
}

And here's the error I encountered:

composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - verbb/formie[2.1.5, ..., 2.1.23] require craftcms/cms ^4.3.2 -> found craftcms/cms[4.3.2, ..., 4.10.8] but it conflicts with your root composer.json require (^5.0.0).
    - Root composer.json requires verbb/formie ^2.1.5 -> satisfiable by verbb/formie[2.1.5, ..., 2.1.23].

Failed to execute command composer update: exit status 2

How can I resolve this?

engram-design commented 1 month ago

You need to be on Craft 4 still and upgrade to the latest Formie version (2.x) while still on Craft 4. This is before you upgrade to Craft 5 and Formie 3.

"craftcms/cms": "^4.0.0",
"verbb/formie": "^2.1.5",

Are the important bits.

romainpoirier commented 1 month ago

I reverted to "craftcms/cms": "^4.0.0" and "verbb/formie": "^2.1.5" and ran a composer update. Then, I upgraded to "craftcms/cms": "^5.0.0" and "verbb/formie": "^3.0.0" and ran another composer update. Composer seems to handle it fine, but I still encounter the same error on the front-end.

It's worth noting that I did go through version 2.1.5 before performing the update.

engram-design commented 1 month ago

I reverted to "craftcms/cms": "^4.0.0" and "verbb/formie": "^2.1.5" and ran a composer update.

After this step, did you apply any migrations? Can you also take note of the version number in your plugins database table for Formie? It sounds like something isn't updating the Formie version at this point.

romainpoirier commented 1 month ago

I apologize for the confusion, I made so many attempts and reverts. Could you please confirm if there is a minimum required version of Craft CMS 4 to update to "verbb/formie": "^2.1.5"? It appears that the update is not available in the Control Panel for Craft CMS 4.7.4.

engram-design commented 1 month ago

Just to be sure, I would set the constraint to a specific version number, like "verbb/formie": "2.1.23" which at the time of writing is the latest Craft 4 release. Well ahead of the minimum version of 2.1.5. Notice the lack of caret character. I would also probably upgrade Craft 4 to its latest release too for good measure at "craftcms/cms": "4.11.0.2". Then run a composer update.

I'm wondering if there's some sort of constraint (maybe from another plugin) that might not be allowing Formie to upgrade to its latest version on Craft 4.

If you're able to do that and things install correctly, let me know the version number in your plugins database table for Formie before proceeding further with the Craft 5 upgrade.

romainpoirier commented 1 month ago

I understand that it's normal for no higher version to be suggested if 2.1.23 is the latest version available for Craft 4. This is in order, and it is defined as such in my composer.json: "verbb/formie": "2.1.23".

From here, I attempted to update to the latest version of Craft CMS 4 (4.11.0.2). However, I encountered errors related to other plugins:

- Root composer.json requires craftcms/cms 4.11.0.2 -> satisfiable by craftcms/cms[4.11.0.2].
- You can only install one version of a package, so only one of these can be installed: enshrined/svg-sanitize[0.16.0, 0.19.0].
- enovatedesign/craft-style-inliner 3.0.6 requires enshrined/svg-sanitize ^0.16.0 -> satisfiable by enshrined/svg-sanitize[0.16.0].
- craftcms/cms 4.11.0.2 requires enshrined/svg-sanitize ~0.19.0 -> satisfiable by enshrined/svg-sanitize[0.19.0].
- Root composer.json requires enovatedesign/craft-style-inliner 3.0.6 -> satisfiable by enovatedesign/craft-style-inliner[3.0.6].

The issue seems to stem from this conflict. I will investigate further.

engram-design commented 1 month ago

Ah, so the enovatedesign/craft-style-inliner plugin seems to be conflicting with Craft, which I thought might be the case with something causing a conflict. Seems like I found your comment on their plugin at https://github.com/enovatedesign/craft-style-inliner/issues/11#issuecomment-1136931444 with a similar issue, but for Craft 3!

Although unrelated to Formie, I'll have a play around with that package.

engram-design commented 1 month ago

Looks to be an issue with Craft 4.11.x actually, so changing the Craft constraint to 4.10.8 is working for me with that package!