Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Linting container while resolving env vars fails out of the box #60824

Closed as duplicate of#59028
@InvisibleSmiley

Description

@InvisibleSmiley

Symfony version(s) affected

7.3

Description

Linting the container while resolving environment variables fails out of the box, i.e. simply following the steps outlined here:

From a user perspective it is not clear how to solve this, even past the initial setup.

If certain environment variables need to be set in order to prevent this from happening, it should at least be documented somewhere. Ideally the problem would not occur at all, e.g. by changing defaults or definitions (generated .env, ...).

In addition to addressing the "out of the box" issue, please explain how users like me can fix the linting in an existing custom app/implementation.

How to reproduce

$ symfony new my_project_directory --version="7.3.x-dev"
* Creating a new Symfony 7.3.x-dev project with Composer
  WARNING: Unable to find Composer, downloading one. It is recommended to install Composer yourself at https://getcomposer.org/download/
  (running .../.symfony5/composer/composer.phar create-project symfony/skeleton .../my_project_directory 7.3.x-dev --no-interaction)

* Setting up the project under Git version control
  (running git init .../my_project_directory)


 [OK] Your project is now ready in .../my_project_directory


$ cd my_project_directory/
$ bin/console lint:container --resolve-env-vars
[critical] Error thrown while running command "lint:container --resolve-env-vars". Message: "Resolved value of "default:kernel.runtime_mode:" did not result in an array value."

In EnvVarProcessor.php line 81:

  Resolved value of "default:kernel.runtime_mode:" did not result in an array value.


lint:container [--resolve-env-vars]

Possible Solution

No response

Additional Context

I found a definition that references the string from the error message in Kernel.php.

Following https://symfony.com/doc/current/reference/configuration/kernel.html#kernel-runtime-mode I then added APP_RUNTIME_MODE= to .env (and removed the var directory to force container recreation) but that made no difference.

Note: My actual app/implementation only contains a CLI command, no web app.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions