fortrabbit / craft-copy

Deployment tools for Craft on fortrabbit
https://www.fortrabbit.com
MIT License
73 stars 8 forks source link

Dependency errors while deploying Craft CMS 3.7.x project #160

Closed martinbroos closed 1 year ago

martinbroos commented 1 year ago

Hi I'm trying to deploy an existing Craft CMS 3.7.x project to FortRabbit but I'm running into this error while deploying. I can do composer upgrade without problems locally. So only when I start the deployment the error occurs. Any idea ?

Commit received, starting build of branch master

–––––––––––––––––––––––  ∙ƒ  –––––––––––––––––––––––

B U I L D

Checksum:
  46b78abafeabccc65dfd8572def2add35b27cd19

Deployment file:
  not found

Pre-script:
  not found
  0ms

Composer:
  - - -
   Installing dependencies from lock file (including require-dev)
   Verifying lock file contents can be installed on current platform.
   Your lock file does not contain a compatible set of packages. Please run composer update.

     Problem 1
       - craftcms/plugin-installer is locked to version 1.5.2 and an update of this package was not requested.
       - craftcms/plugin-installer 1.5.2 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
     Problem 2
       - yiisoft/yii2-composer is locked to version 2.0.5 and an update of this package was not requested.
       - yiisoft/yii2-composer 2.0.5 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
     Problem 3
       - craftcms/plugin-installer 1.5.2 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.3.0] but it does not match the constraint.
       - craftcms/cms 3.0.0-RC15 requires craftcms/plugin-installer ~1.5.0 -> satisfiable by craftcms/plugin-installer[1.5.2].
       - craftcms/cms is locked to version 3.0.0-RC15 and an update of this package was not requested.

My composer.json:

{
  "require": {
    "craftcms/cms": "^3.5",
    "craftcms/redactor": "2.10.11",
    "superbig/craft3-mobiledetect": "^1.0",
    "la-haute-societe/craft-webpack-assets": "^2.0",
    "yiisoft/yii2-redis": "^2.0",
    "spicyweb/craft-embedded-assets": "2.11.3",
    "hybridinteractive/craft-position-fieldtype": "^1.0",
    "vlucas/phpdotenv": "^5.5",
    "fortrabbit/craft-copy": "^1.2"
  },
  "require-dev": {
    "yiisoft/yii2-shell": "^2.0.3"
  },
  "autoload": {
    "psr-4": {
      "modules\\": "modules/"
    }
  },
  "config": {
    "platform": {
      "php": "8.1.14"
    },
    "optimize-autoloader": true,
    "allow-plugins": {
      "yiisoft/yii2-composer": true,
      "craftcms/plugin-installer": true,
      "fortrabbit/craft-auto-migrate": true
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
      "@composer dump-autoload -o",
      "@php craft setup/welcome"
    ]
  }
}

I'm not sure why it says I'm using Craft CMS 3 RC version.

pheeque1 commented 1 year ago

Hi Martin,

It looks like your composer lock file might not have been committed to git and is not pushed to your app so composer complains about incompatible packages. Please ensure that all files are tracked in git and try again.

If this still doesn't solve the problem, you can also try resetting the deploy git repo with the instructions here.

I was able to reproduce a Craft project using your composer.json file and push to a test fortrabbit app with no issues.

martinbroos commented 1 year ago

Hi, thanks for your response. I checked in bitbucket and the composer.lock file is there and is updated recently so it should still be available for deployment.

After that I tried your suggestion about resetting the deploy git. But with no success.

Any other ideas ?

pheeque1 commented 1 year ago

Hmm, I can only imagine that this issue is not particular to Craft Copy and will be better solved in official fortrabbit support. Please open a support ticket by sending us a message from the dashboard.

Thanks.

martinbroos commented 1 year ago

I managed to get it working by first doing a manual git push to the fortrabbit github. After that when I run php craft copy/code/up prod the composer errors are no longer there. But it does seem that new commits after this don't get synced..

pheeque1 commented 1 year ago

Please do open a support ticket from the fortrabbit dashboard and we can pick up from there.

Thanks.