Problem/Motivation

When adding Cloudflare Purge to Install Profile, installation fails. This did not happen on any version of 2.0.X Cloudflare purge

Drupal\Core\Config\PreExistingConfigException: Configuration objects (cloudflare_purge.settings) provided by cloudflare_purge already exist in active configuration in Drupal\Core\Config\PreExistingConfigException::create() (line 65 of /var/www/docroot/core/lib/Drupal/Core/Config/PreExistingConfigException.php).

Steps to reproduce

Add cloudflare_purge into your install_profile name.info.yml file and run the installation from website or command line.

Proposed resolution

I don't have a proposed solution but seems like something in the install script is causing the issue, and it's not checking that the data is already there from the config/install yml files.

Comments

eric.guerin@ucsf.edu created an issue. See original summary.

flashwebcenter’s picture

Title: Cloudflare Purge break install profile if included » PreExistingConfigException when Cloudflare Purge is included in an install profile
Status: Needs work » Needs review

Thank you for reporting this issue.

Installation failed with PreExistingConfigException because Cloudflare Purge originally shipped default config in config/install/. When the module was added as a dependency in an install profile, that same config could already exist from the profile, so Drupal refused to install it again.

Default config was moved from config/install/ to config/optional/.
cloudflare_purge.settings is now only installed if it does not already exist, which prevents conflicts with profile-provided config.
hook_install() now only fills in missing NULL keys instead of overwriting existing values.
This means standalone installs still get full defaults, while profile-based installs keep their existing config and only receive newly missing keys.

With this change, adding Cloudflare Purge as an install profile dependency should no longer trigger PreExistingConfigException.
Please test the latest dev release with your profile. If it still fails, share the exact error and install steps.

Best wishes,
Alaa

flashwebcenter’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

eric.guerin@ucsf.edu’s picture

Awesome, thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.