Skip to content

Custom Flex recipe from private GitHub repo not copying files despite correct manifest, endpoint, and cache state #1052

Closed
@tchwicewski99

Description

@tchwicewski99

Hello Symfony Team,

I am encountering a persistent issue where Symfony Flex is not copying files from a custom recipe hosted on a private GitHub repository. This occurs even though:

  • Flex correctly identifies and downloads the index.json from the specified branch (flex/main).
  • Flex correctly identifies and downloads the specific recipe manifest JSON file (e.g., for version 1.0) from the specified branch.
  • The recipe manifest JSON contains a correctly structured manifest.files section with inlined content.
  • Flex output during installation/update states "Copying files from recipe".

Despite these indications, no files are actually copied to the project's target directories. Consequently, composer recipes <package> shows an empty files: [] list, and the application fails due to missing configuration files (e.g., Symfony\Component\Config\Definition\Exception\InvalidConfigurationException).

Environment:

  • Symfony Flex Version: 2.7.0
  • Composer Version: 2.8.4
  • PHP Version: 8.3.13
  • Operating System: Windows 11

Problem Description:

When installing tchwicewski99/takeoff-core-bundle (version v1.0.0), Symfony Flex identifies the custom recipe version 1.0 from our private GitHub recipe repository (tchwicewski99/takeoff-core-bundle-recipes on branch flex/main). Verbose logs (-vvv) confirm successful download of both index.json and the tchwicewski99.takeoff-core-bundle.1.0.json manifest. Flex reports "Copying files from recipe".

However, the files defined in manifest.files (specifically config/packages/takeoff_core.yaml in the provided test case) are not created in the project. composer recipes tchwicewski99/takeoff-core-bundle shows files : (empty). This leads to an InvalidConfigurationException for takeoff_core.user_class during cache:clear as the configuration file is missing.

Steps to Reproduce:

  1. Private Recipe Repository (tchwicewski99/takeoff-core-bundle-recipes on flex/main branch):
    index.json:
{
    "recipes": {
        "tchwicewski99/takeoff-core-bundle": [
            "1.0"
        ]
    },
    "branch": "flex/main",
    "is_contrib": false,
    "_links": {
        "repository": "github.com/tchwicewski99/takeoff-core-bundle-recipes",
        "origin_template": "{package}:{version}@github.com/tchwicewski99/takeoff-core-bundle-recipes:flex/main",
        "recipe_template": "https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/{package_dotted}.{version}.json?ref=flex/main"
    }
}

tchwicewski99.takeoff-core-bundle.1.0.json

{
  "manifests": {
    "tchwicewski99/takeoff-core-bundle": {
      "manifest": {
        "bundles": {
          "tchwicewski99\\TakeoffCoreBundle\\TakeoffCoreBundle": [
            "all"
          ]
        },
        "copy-from-recipe": {
          "config/": "%CONFIG_DIR%/"
        },
        "files": {
          "config/packages/takeoff_core.yaml": {
            "contents": [
              "takeoff_core:",
              "  user_class: 'App\\Entity\\User'",
              "",
              "  registration:",
              "    enabled: true",
              "    phone_number_field_visible: true",
              "    phone_number_required: false",
              "    phone_number_verification_on_phone_provided: false",
              "    verification_mode: 'email_required_phone_optional'",
              "    user_enabled_condition: 'after_primary_verification'",
              "    default_locale: 'en'",
              "    email_verification_token_ttl: 86400",
              "    phone_verification_code_ttl: 300",
              "    password_min_length: 8",
              "",
              "  login:",
              "    enabled: true",
              "",
              "  security:",
              "    remember_me:",
              "      enabled: true",
              "",
              "  acp:",
              "    enabled: true",
              "    host: null",
              "    route_prefix: '/admin'",
              "    admin_role: 'ROLE_ADMIN'",
              "    default_items_per_page: 25",
              "",
              "  login_history:",
              "    enabled: true",
              "    log_user_agent: true",
              "",
              "  notification_log:",
              "    enabled: true",
              "",
              "  notifications:",
              "    from_email: 'no-reply@example'",
              "    from_name: 'Takeoff Application'",
              "    app_name: 'Takeoff Application'",
              "    email_verification_subject: 'Verify your email address for %appName%'",
              "    password_reset_subject: 'Your password reset request for %appName%'",
              "    phone_verification_sms_template: 'Your %appName% verification code is: %code%'"
            ],
            "executable": false
          }
          // For testing, this was the only file included in "files" and "copy-from-recipe"
        },
        "post-install-output": [
          "tchwicewski99/takeoff-core-bundle recipe compiled and installed successfully!",
          "Make sure to check any .env variables or further configuration steps."
        ]
      },
      "ref": "163559ad971051c0e44153794450b3f19bdbe202" // This ref is from the provided manifest example
    }
  }
}
  1. Test symfony project (symfony/webapp skeleton):
    composer.json:
"extra": {
    "symfony": {
        "allow-contrib": true,
        "endpoint": [
            "https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/index.json?ref=flex/main",
            "flex://defaults"
        ],
        "require": "7.2.*", // Or your Symfony version
        "docker": true
    }
}
  1. Execution Steps in Test Project:
    composer clear-cache
    Manually delete C:/Users/USER/AppData/Local/Composer/repo/flex/
    In the project directory: rm -f composer.lock symfony.lock && rm -rf vendor/
    Run: composer require tchwicewski99/takeoff-core-bundle:^1.0 -vvv

Actual Behavior:

  • Logs confirm index.json and tchwicewski99.takeoff-core-bundle.1.0.json are downloaded successfully (HTTP 200) from the flex/main branch.
  • Flex reports "Configuring tchwicewski99/takeoff-core-bundle (>=1.0)... Copying files from recipe"
  • No files are created in the project.
  • composer recipes tchwicewski99/takeoff-core-bundle shows files : (empty list).
  • The symfony.lock file, when inspected, shows an empty files array for the recipe tchwicewski99/takeoff-core-bundle.

Verbose Logs from composer require tchwicewski99/takeoff-core-bundle:^1.0 -vvv (after all clearing steps):

Running 2.8.4 (2024-12-11 11:57:47) with PHP 8.3.13 on Windows NT / 10.0
Reading ./composer.json (...)
Loading config file C:/Users/tchwi/AppData/Roaming/Composer/config.json
Loading config file C:/Users/tchwi/AppData/Roaming/Composer/auth.json
Loading config file ./composer.json (...)
[...]
Reading C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app/vendor/composer/installed.json (...)
Loading plugin Symfony\Component\Runtime\Internal\ComposerPlugin (from symfony/runtime)
Loading plugin Symfony\Flex\Flex (from symfony/flex)
[...]
Reading composer.json of tchwicewski99/takeoff-core-bundle (v1.0.0)
Importing tag v1.0.0 (1.0.0.0)
[...]
./composer.json has been updated
Unloading plugin Symfony\Flex\Flex
Unloading plugin Symfony\Component\Runtime\Internal\ComposerPlugin
Reading ./composer.json (...)
Loading config file C:/Users/tchwi/AppData/Roaming/Composer/config.json
Loading config file C:/Users/tchwi/AppData/Roaming/Composer/auth.json
Loading config file ./composer.json (...)
Reading C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app/vendor/composer/installed.json (...)
Loading plugin Symfony\Component\Runtime\Internal\ComposerPlugin_composer_tmp0 (from symfony/runtime)
Loading plugin Symfony\Flex\Flex_composer_tmp1 (from symfony/flex)
Running composer update tchwicewski99/takeoff-core-bundle
Reading ./composer.lock (...)
> pre-update-cmd: Symfony\Flex\Flex_composer_tmp1->configureInstaller
Loading composer repositories with package information
[...]
> pre-pool-create: Symfony\Flex\Flex_composer_tmp1->truncatePackages
Reading C:/Users/tchwi/AppData/Local/Composer/repo/flex/tchwicewski99-takeoff-core-bundle-recipes-index.json-ref-flex-main from cache
Reading C:/Users/tchwi/AppData/Local/Composer/repo/flex/symfony-recipes-flex-main-index.json from cache
Reading C:/Users/tchwi/AppData/Local/Composer/repo/flex/symfony-recipes-contrib-flex-main-index.json from cache
Using GitHub token authentication
Downloading https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/index.json?ref=flex/main if modified
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
[304] https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
[304] https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
[200] https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/index.json?ref=flex/main
Writing C:/Users/tchwi/AppData/Local/Composer/repo/flex/tchwicewski99-takeoff-core-bundle-recipes-index.json-ref-flex-main into cache
Built pool.
[...]
Updating dependencies
[...]
Lock file operations: 4 installs, 0 updates, 0 removals
Installs: giggsey/locale:2.8.0, symfony/intl:v7.2.6, giggsey/libphonenumber-for-php:9.0.5, tchwicewski99/takeoff-core-bundle:v1.0.0
  - Locking tchwicewski99/takeoff-core-bundle (v1.0.0) from vcs repo (git ../repository)
Writing lock file
Installing dependencies from lock file (including require-dev)
Reading ./composer.lock (...)
> pre-operations-exec: Symfony\Flex\Flex_composer_tmp1->recordOperations
Package operations: 4 installs, 0 updates, 0 removals
Installs: giggsey/locale:2.8.0, symfony/intl:v7.2.6, giggsey/libphonenumber-for-php:9.0.5, tchwicewski99/takeoff-core-bundle:v1.0.0
[...]
  - Installing tchwicewski99/takeoff-core-bundle (v1.0.0): Cloning 6fef24bfbcb4dfc6d96193ce671df2574762a01c
[...]
> post-package-install: Symfony\Flex\Flex_composer_tmp1->recordFlexInstall (for tchwicewski99/takeoff-core-bundle)
[...]
Generating autoload files
> post-autoload-dump: Symfony\Component\Runtime\Internal\ComposerPlugin_composer_tmp0->updateAutoloadFile
[...]
> post-update-cmd: Symfony\Flex\Flex_composer_tmp1->update
Reading C:/Users/tchwi/AppData/Local/Composer/repo/flex/tchwicewski99-takeoff-core-bundle-recipes-tchwicewski99.takeoff-core-bundle.1.0.json-ref-flex-main from cache
Downloading https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/tchwicewski99.takeoff-core-bundle.1.0.json?ref=flex/main if modified
[200] https://api.github.com/repos/tchwicewski99/takeoff-core-bundle-recipes/contents/tchwicewski99.takeoff-core-bundle.1.0.json?ref=flex/main
Writing C:/Users/tchwi/AppData/Local/Composer/repo/flex/tchwicewski99-takeoff-core-bundle-recipes-tchwicewski99.takeoff-core-bundle.1.0.json-ref-flex-main into cache

Symfony operations: 1 recipe (bf2216c5fd56d2613243f45aa2652810)
  - Configuring tchwicewski99/takeoff-core-bundle (>=1.0): From github.com/tchwicewski99/takeoff-core-bundle-recipes:flex/main
    Enabling the package as a Symfony bundle
    Copying files from recipe
> post-update-cmd: @auto-scripts
> auto-scripts: Symfony\Flex\Flex_composer_tmp1->executeAutoScripts
Executing script cache:clear
Executed script cache:clear  [KO]
 [KO]
Script cache:clear returned with error code 1
!!
!!  In ArrayNode.php line 213:
!!
!!    [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
!!    The child config "user_class" under "takeoff_core" must be configured: The fully qualified cl
!!    ass name of your User entity (must implement CoreUserInterface).
!!
!!  Exception trace:
!!    at C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app\vendor\symfony\config\Definition\ArrayNode.php:213
!!    Symfony\Component\Config\Definition\ArrayNode->finalizeValue() at C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app\vendor\symfony\config\Definition\BaseNode.php:393
[...]
!!    tchwicewski99\TakeoffCoreBundle\DependencyInjection\TakeoffCoreExtension->load() at C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app\vendor\symfony\dependency-injection\Compiler\MergeExtensionConfigurationPass.php:81
[...]
!!    require_once() at C:\Users\tchwi\Documents\Klienci\Projekty\Takeoff Core Bundle\takeoff_core_test_app\bin\console:15
!!
Script @auto-scripts was called via post-update-cmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions