PreExistingConfigException During First-Time Site Installation

Created on 19 August 2024, 4 months ago
Updated 21 August 2024, 4 months ago

Environment:
• Drupal Version: WxT 5.2.2
• Hosting: Azure (Secure Landing Zone)
• Deployment Method: Azure DevOps pipeline

Issue Description:
During the first-time site installation on a newly deployed Drupal instance, we encounter a PreExistingConfigException at the final step of the installation process. This occurs despite using a newly created, empty database.

Error Message:
The website encountered an unexpected error. Try again later.
Drupal\Core\Config\PreExistingConfigException: Configuration objects (bootstrap.settings) provided by bootstrap already exist in active configuration in Drupal\Core\Config\PreExistingConfigException::create() (line 65 of core/lib/Drupal/Core/Config/PreExistingConfigException.php).

Stack Trace:
Drupal\Core\Config\PreExistingConfigException::create() (Line: 538)
Drupal\Core\Config\ConfigInstaller->checkConfigurationToInstall() (Line: 132)
Drupal\Core\ProxyClass\Config\ConfigInstaller->checkConfigurationToInstall() (Line: 225)
Drupal\Core\Extension\ThemeInstaller->install() (Line: 1641)
install_profile_themes() (Line: 707)
install_run_task() (Line: 578)
install_run_tasks() (Line: 121)
install_drupal() (Line: 48)

Steps to Reproduce:
1. Deploy Drupal using our Azure DevOps pipeline (all steps complete successfully)
2. Visit the new portal for the first time to set up and install the site
3. Proceed through the installation process
4. At the very end of the install site process, the error occurs

Expected Behavior:
The site installation should complete successfully without any errors.

Actual Behavior:
The installation fails with a PreExistingConfigException, suggesting that configuration objects already exist in the active configuration.

Additional Information:
• The database used is newly created and should be empty
• Microsoft technical support has reviewed our infrastructure and found no issues that could interfere or generate this error
• The Microsoft engineer was unable to reproduce this error in their lab environment

Questions:
1. What could cause a PreExistingConfigException during a first-time installation on a new database?
2. Are there any known issues with WxT 5.2.2 installations in Azure environments that could lead to this error?
3. How can we troubleshoot or resolve this issue to complete the site installation?

Any assistance or guidance would be greatly appreciated. We can provide additional information or logs if needed.

💬 Support request
Status

Active

Version

5.2

Component

WxT Bootstrap

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 🇺🇸United States drumm NY, US
  • 🇨🇦Canada joseph.olstad

    Hi Steve, I would like to follow along with you as I haven't tested our own installation instructions in a few months.

    Firstly, I would recommend installing wxt 5.2.3 instead of wxt 5.2.2

    Secondly, which installation instructions are you following?

    Normally I'd suggest following these instructions:

    https://drupalwxt.github.io/docs/general/installation/

    or

    https://github.com/drupalwxt/wxt-project

    From there, I can also guide you on creating a subtheme, there's some readme instructons for that in the wxt_bootstrap theme folder that comes out of the installation.

  • 🇨🇦Canada joseph.olstad

    To narrow down our focus, is this more of an Azure issue or a general first time installation issue?

    Have you tested this procedure locally? Normally before deploying to Azure, you should test this in a local environment. You'd normally want to set up a git repository to store your project and then use that in a deployment pipeline at some point for a cloud service, azure or aws for example.

    For a cloud service you'll need a filesystem mapping for the assets so that Drupal can write files to it such as aggregated css and aggregated js, twig cache and store images/documents.

    What docker images are you using and what instructions are you following for docker?

  • 🇨🇦Canada optasy

    I tested this issue myself and I didn't see that issue, I agree with @joseph.olstad , this looks like an Azure issue to me, could you provide the logs, please?

  • 🇨🇦Canada smulvih2 Canada 🍁

    I have not run into this issue installing WxT on Azure. The error message indicates that the config bootstrap.settings is already in active configuration. Seems like you have existing entries in the database, is it possible a previous install attempt was made? I would suggest emptying the database and start again, ensuring the database is completely empty. You could also check the value for the bootstrap.settings config during the install process to see when it gets set.

  • Thank you all for the quick replies and the very valuable tips on what to look at.
    as you suggest Joseph I'll update to version 5.2.3
    To deploy we are using DevOps with the artifacts, repo & pipeline:
    az artifacts universal download/publish --organization https://dev.azure.com/ourcorp --project="Drupal_Corp_Websites" --scope project --feed DrupalFeed --name drupalwxt --version 5.2.3 --description "Drupal WXT" --path C:\Temp\Drupal
    then we run the pipeline to update the php image on the docker
    then another pipeline run to upload the image from the docker to the container registry and deploy to Web App in Azure.

    We have been using Microsoft services to help us set/prepare our Azure environment Prior the deployment.

    The very first deployment the database services was create from scratch with no database yet created in it.
    When i ran the setup at #3 Set Up the database, I give a unique name to the database and only during this next and install site everything is installing/completed at 100%.
    i get a green status message saying
    "Thanks for installing Block Class. Now in the block configuration
    you will see a field to add your classes....

    Nothing to check.

    No configuration objects have been updated."

    "The website encountered an unexpected error. Try again later.

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

    Drupal\Core\Config\PreExistingConfigException :: create('bootstrap'
    Array) (Line: 538)
    Drupal\Core\Config\ConfigInstaller-
    >checkConfigurationToInstall('theme', 'bootstrap') (Line: 132)
    Drupal\Core\ProxyClass\Config\ConfigInstaller-
    >checkConfigurationToInstall('theme', 'bootstrap') (Line: 225)
    Drupal\Core\Extension\ThemeInstaller->install(Array) (Line:
    1641)
    install_profile_themes(Array) (Line: 707)
    install_run_task(Array, Array) (Line: 578)
    install_run_tasks(Array, NULL) (Line: 121)
    install_drupal(Object) (Line: 48)"

    If i refresh the page it will take me directly from choose language to Configure site.

    The Microsoft tech have his lab and couldn't replicate my issue either. He suggested that I reach out here for additional help.

    Here I am.

    I'll revisit the links with instructions that Joseph has posted as i install version 5.2.3

    Many thanks for your help & insights all, I truly appreciate this.

  • 🇨🇦Canada joseph.olstad

    path C:\Temp\Drupal
    It appears you're installing Drupal using Windows. I cannot support windows as I do not have this operating system available.

    Perhaps consider using the wxt docker scaffold instead and deploy this using a Linux target host instead.

  • 🇨🇦Canada smulvih2 Canada 🍁

    From the error message in #7, this appears to be a config issue, not environment related. The PreExistingConfigException during a first-time site installation is an unusual issue, especially on a new Drupal instance with an empty database. The error indicates that some configuration objects already exist in the active configuration, even though the database should be clean.

    I am closing this as can't reproduce. If the problem still persists, please re-open and provide details. Thanks!

Production build 0.71.5 2024