Closed gremo closed 1 month ago
Have you cleared your opcache?
@maxhelias Do you think it's relevant at build time?
Anyways I removed all OPcache features from Docker
file, and still the problem persist.
You're right, but without reproducer, I can only throw out ideas. Have your rebuild your docker image without cache ?
@maxhelias Yes, I know. Thanks for your help.
And yes, I completely removed all containers and volumes before rebuilding for production.
However, the issue can easily be reproduced by installing the Mailer component and the Monolog bundle, and simply pasting that configuration.
It seems that the configuration requires the MAILER_DNS
environment variable (which makes sense, as it's used for sending emails). For some reason, during the cache clearing process, the generated .env.local.php
(which in fact contains MAILER_DNS
) file isn't being considered.
The fix is putting ENV MAILER_DSN=null://null in the Dockerfile.
But I'd like to solve it in the right way!
Hello @gremo!
Are you have declared (and uncommented) MAILER_DSN
variable in your .env
?
It must be declared automatically when you install symfony/mailer
by the https://github.com/symfony/recipes/blob/main/symfony/mailer/4.3/manifest.json recipe.
@7-zete-7 nice catch! It works indeed uncommenting (it's commented by default).
But... why? Can you explain why .env.local.php
isn' considered when clearing the cache?
@gremo, the .env.local.php
- is optimized version of the configured environment.
This file generates only for runtime and reflects the same configuration of your .env
files. Symfony can avoid this file usage on development or maintenance processes.
Any changes to .env.local.php
can (and will) be ignored by not reading it or by overwriting it.
I've the following error when building for production:
The issue occurs only when using the following monolog configuration:
I've double checked
.env.local.php
generated by composer dump-env prod and it contains theMAILER_DSN
variable. Any help is much appreciated!