0

Looking to get some advice on fixing some issues I'm having with my Craft DEV environment. I merged some changes which worked fine locally, but are causing some issues on my deployed version.

Problems include:

  1. Internal server errors when trying load entries
  2. None of my plugins are showing in the dashboard (but appear to be included in the loaded project config). Re-applying the project config via the dashboard also causes 500 internal server errors.

These changes have since been reverted, however the problems are still persisting.

Things I've tried:

  1. Revert the DB to a previous snapshot (same problems still persist).
  2. Rebuild the project config locally then push the changes to DEV (same problems still persist).
  3. Reapply project config via DEV dashboard (results in fatal server error)

I'm not really sure what to do now?

  1. Rebuild the DEV branch from the PROD branch?
  2. Nuke the DEV DB and clone the PROD DB?

Any help is appreciated, thanks everyone!

Error enter image description here

Plugins in loaded project config enter image description here

Craft version and no loaded plugins enter image description here

2 Answers 2

2

My guess ... this has nothing todo with project config:

  • The missing plugins might have to do with a missing or corrupt file vendor/craftcms/plugins.php which is written by a Craft script and triggered by composer during composer install

  • There was a recent change with composer which requires to explicitly whitelist every composer package (e.g. Craft) which is allowed to execute those scripts and therefor create this file

  • please check if you have the following lines in your composer.json (there might be more) within the config node of your composer.json file, they do this whitelisting:

    "config": {
      "allow-plugins": {
        "craftcms/plugin-installer": true,
        "yiisoft/yii2-composer": true
      }
    
  • now try your deployment again

  • the errors 500 might result from TWIG commands provided by one of your plugins which are not available due to the missing plugins

1
  • Hi Matthias, thank you for the answer, this did solve my deployment issue - I'm running composer v2.0.13 which according to the Craft docs you should only need to explicitly allow plugins if you're running composer v2.2+... or maybe I'm missing something? Anyways, I rebuilt the project config locally and added your recommended changes to composer.json and this fixed the issue. Thanks Jul 19, 2022 at 1:18
0

It might be a good idea before doing anything to understand what the specific 500 error being raised is. Enable dev mode so you can see the full error output, or look in the log files and paste the specific error here.

If it is project config related, to recover the dev environment, the best way is probably to apply a fresh copy of the database to your dev environment. You might also want to complete remove the contents of the config/project directory and once the restore completes let Craft rebuild it, which should be the same values in the production database. This gets triggered when loading the control panel.

Although project config is designed in the direction of propagating upwards, this can be occasionally done to recover from situations, but normally project config should be in source control and you shouldn't need to do this. Equally, make sure project config changes happen on local environments which then get pushed up to each environment in the chain ending at production.

Other than dev, make sure you don't allow admin change with the config setting, as this is potentially how project config can get messy:

https://craftcms.com/docs/3.x/config/config-settings.html#allowadminchanges

2
  • Thanks for the answer James - I don't think my issue was config related after all, it seemed to be a composer package issue. Our project config is managed in git and allowAdminChanges is only applied in local environments so we generally don't have issues with the config - but yeah this only threw me a bit... possibly because of our overcomplicated Docker setup. Thanks Jul 19, 2022 at 1:24
  • @KyleLambert Glad you sorted it, it's always good to have devMode on to see the full error trace in local/dev. "Internal Server Error" is just generic when not running devMode and won't tell you much without looking through logs. Jul 19, 2022 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.