Closed captsulu closed 2 years ago
Hi.
I took you composer.json, and I tried it with php 7.4, and php 8.1 and I cannot reproduce your issue.
>/tmp/foobar php7.4 bin/console cache:clear -vvv
// Clearing the cache for the dev environment with debug true
// Warming up cache...
// Removing old build and cache directory...
// Finished
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
>/tmp/foobar php7.4 bin/console cache:warmup -vvv
// Warming up the cache for the dev environment with debug true
[OK] Cache for the "dev" environment (debug=true) was successfully warmed.
Could you create a reproducer to help us to fix this issue? thanks
I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.
I am sort of a newbie at this. I'll look through the rest of my yaml files to see if I have anything that is configured wrong that could be causing the problem.
On Wed, Mar 9, 2022 at 2:08 PM Christian Flothmann @.***> wrote:
I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.
— Reply to this email directly, view it on GitHub https://github.com/symfony/symfony/issues/45614#issuecomment-1063263045, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAEPG4I3RELUEMEPINDEODU7DZMJANCNFSM5PXOXUKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
Gregory Neely Mobile: 386-631-8311 opencloudstart.com Web Developer CNO financial
HI, I have the same problem and i can't use php bin/console make:migration or symfony console make:migration i have an error who said Command "make:migration" is not defined.
What I found it something in your config is misconfigured.
On Fri, Mar 18, 2022 at 5:47 PM nature-web @.***> wrote:
HI, I have the same problem and i can't use php bin/console make:migration or symfony console make:migration i have an error who said Command "make:migration" is not defined.
— Reply to this email directly, view it on GitHub https://github.com/symfony/symfony/issues/45614#issuecomment-1072841159, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADAEPGZPNTMOULXLYGDODX3VAT2X7ANCNFSM5PXOXUKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.Message ID: @.***>
--
Gregory Neely Mobile: 386-631-8311 opencloudstart.com Web Developer CNO financial
I had a very similar problem and was getting Failed to generate ConfigBuilder for extension
errors when running certain bin/console
commands. After spending several hours tracing through my code and Symfony code in an attempt to find the issue, I finally solved it by updating the bin/console
file (I copied it from a recent fresh install of Symfony 5.4).
The site with this problem was originally created on Symfony 4 and had been updated to Symfony 5. While all the packages were updated, the actual bin/console
file was still the original version. The old bin/console
command handles the loading of .env
variables differently than more recent versions and this was the cause of the error messages.
I was expecting the bin/console
command to be automatically updated when the symfony/console
package is updated, but apparently that is not how it works.
Had tons of Failed to generate ConfigBuilder for extension
Found this phrase at ConfigBuilderCacheWarmer
After commenting out exception catching like this:
// try {
$this->dumpExtension($extension, $generator);
// } catch (\Exception $e) {
// if ($this->logger) {
// $this->logger->warning('Failed to generate ConfigBuilder for extension {extensionClass}.', ['exception' => $e, 'extensionClass' => \get_class($extension)]);
// }
// }
and running bin/console cache:warmup
I've got true the reason:
In EnvVarProcessor.php line 172:
Environment variable not found: "BLA_BLA_BLA".
So, to fix annoying Failed to generate ConfigBuilder for extension
messages I had to just add accidentally missed BLA_BLA_BLA=
to .env
Same issue here.
For me it was in an upgraded SF4 LTS to SF5 LTS project: Environment variable not found: "APP_SECRET".
Upgrading bin/console to use the new runtime component did not fix anything here, but still is a good idea.
Thanks to @igormukhingmailcom for the simple idea! The exception message should include the original exception message. See CacheWarmer/ConfigBuilderCacheWarmer.php around line 59.
Simply add $e->getMessage()
to the log message to find the real reason:
$this->logger->warning('Failed to generate ConfigBuilder for extension {extensionClass}.' . $e->getMessage(), ['exception' => $e, 'extensionClass' => \get_class($extension)]);
Well, the log context includes the original exception.
We could still replicate the message up in the chain to make it easier to see I think. @kevinpapst up for a PR doing so?
@nicolas-grekas Sure. The message is the only way to see the causing issue and it believe missing ENVs might happen from time to time, not only for us who posted here ;-)
You know what is troubling me: even though cache warmup failed, the app worked totally fine. And the logs contained one message for every registered bundle, while the only place where APP_SECRET is accessed is in the framework.secret
config and therefor in the container build process:
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Symfony\Bundle\TwigBundle\DependencyInjection\TwigExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Doctrine\Bundle\MigrationsBundle\DependencyInjection\DoctrineMigrationsExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Doctrine\Bundle\MigrationsBundle\DependencyInjection\DoctrineMigrationsExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Symfony\Bundle\MonologBundle\DependencyInjection\MonologExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Sensio\Bundle\FrameworkExtraBundle\DependencyInjection\SensioFrameworkExtraExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Sensio\Bundle\FrameworkExtraBundle\DependencyInjection\SensioFrameworkExtraExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Symfony\WebpackEncoreBundle\DependencyInjection\WebpackEncoreExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Symfony\WebpackEncoreBundle\DependencyInjection\WebpackEncoreExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension Twig\Extra\TwigExtraBundle\DependencyInjection\TwigExtraExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "Twig\Extra\TwigExtraBundle\DependencyInjection\TwigExtraExtension"]
15:17:49 WARNING [app] Failed to generate ConfigBuilder for extension BabDev\PagerfantaBundle\DependencyInjection\BabDevPagerfantaExtension. ["exception" => Symfony\Component\DependencyInjection\Exception\EnvNotFoundException { …},"extensionClass" => "BabDev\PagerfantaBundle\DependencyInjection\BabDevPagerfantaExtension"]
So I wonder if the log issue is the correct place to look at or if missing ENV should be reported otherwise?
- Had tons of
Failed to generate ConfigBuilder for extension
- Found this phrase at
ConfigBuilderCacheWarmer
After commenting out exception catching like this:
// try { $this->dumpExtension($extension, $generator); // } catch (\Exception $e) { // if ($this->logger) { // $this->logger->warning('Failed to generate ConfigBuilder for extension {extensionClass}.', ['exception' => $e, 'extensionClass' => \get_class($extension)]); // } // }
and running
bin/console cache:warmup
I've got true the reason:In EnvVarProcessor.php line 172: Environment variable not found: "BLA_BLA_BLA".
- So, to fix annoying
Failed to generate ConfigBuilder for extension
messages I had to just add accidentally missedBLA_BLA_BLA=
to.env
I literally just logged in just to say thank you!
- Had tons of
Failed to generate ConfigBuilder for extension
- Found this phrase at
ConfigBuilderCacheWarmer
After commenting out exception catching like this:
// try { $this->dumpExtension($extension, $generator); // } catch (\Exception $e) { // if ($this->logger) { // $this->logger->warning('Failed to generate ConfigBuilder for extension {extensionClass}.', ['exception' => $e, 'extensionClass' => \get_class($extension)]); // } // }
and running
bin/console cache:warmup
I've got true the reason:In EnvVarProcessor.php line 172: Environment variable not found: "BLA_BLA_BLA".
- So, to fix annoying
Failed to generate ConfigBuilder for extension
messages I had to just add accidentally missedBLA_BLA_BLA=
to.env
You sir saved my day! Thank you!
The Failed to generate ConfigBuilder for extension
log warning includes the exception in the context, so you should have access to the exception message in your logs though.
The
Failed to generate ConfigBuilder for extension
log warning includes the exception in the context, so you should have access to the exception message in your logs though.
What caused me the confusion personally is that I was only looking at the warning log in symfony server. After actually checking ConfigBuilderCacheWarmer I realised it is properly logged with the context.
One more thing related to missed env var.
If you're working with Sylius and missed some env var at your .env
,
you will find this exception:
[Sylius\Bundle\FixturesBundle\Suite\SuiteNotFoundException]
Suite with name "some_suite" could not be found!
when running symfony console sylius:fixtures:load some_suite -n
.
Probably in case when you're using some of that missed env vars at your fixture suite configuration.
Can we replace the log to $this->logger?->warning('Failed to generate ConfigBuilder for extension {extensionClass}.', ['exception' => $e->getMessage(), 'extensionClass' => \get_class($extension)]);
Currently the exception message is not visible
Hi, once I got this problem because in my services.yaml I had some parameters that wasnt on my .env files . Check that!
Optionnaly , To have full detail of this exception , we can use option -vvv in the command . This option is rather natural .
I find it weird that I have to supply all environment variables upon build time to not get warnings. Env-vars are supposed to be runtime vars.
So if I have to set all env parameters to empty defaults, what's the point of this warning? What is it warning me of? I still don't get a warning if I forget to set the env var on the production server at runtime.
Symfony version(s) affected
5.3.12
Description
When clearing cache or warming up cache I get the following warning messages in the cli.
How to reproduce
Possible Solution
I attached my composer.json so you could look at the packages that I have installed to see if they are what may be cauing this issue.
Additional Context
As far as we can tell no operational impact at this time, but we are concerned that it may have an impact in the future as we migrate to a newer version of Symfony.