-1

After upgrading to symfony 5, I found a warning of a missing asset of symfony's error-handler:

php.WARNING: Warning: include(/var/www/projekt/nakade/vendor/symfony/error-handler/ErrorRenderer/../Resources/assets/css/error.css): failed to open stream: No such file or directory {"exception":"[object] (ErrorException(code: 0):

After investigating this issue I found the assets directory missing in prod environment while in dev env directory and css class is existing. I assume the css is missing because the component is just in require-dev.

"require-dev": { ... "symfony/browser-kit": "5.0.*", "symfony/css-selector": "5.0.*", "symfony/debug-bundle": "5.0.*", "symfony/maker-bundle": "^1.13", "symfony/phpunit-bridge": "^5.0", "symfony/profiler-pack": "1.0.*", "symfony/test-pack": "^1.0", "symfony/var-dumper": "5.0.*" },

The env var is set in .env.local APP_ENV=prod The error message showed up by the google-bot due to a missing robots.txt and sitemap.xml. THis is fixed and error and the warning is gone but I curious about it.

Has someone an idea how to fix this?

Sam Mumm
  • 84
  • 9
  • 1
    Can you share your .env from production (APP_ENV) ? – Gary Houbre Apr 21 '20 at 11:25
  • 2
    Ensure that APP_ENV is set to prod, you do not need error.css in production environment – Michal Picpauer Apr 21 '20 at 12:43
  • .env.local on production APP_ENV=prod | .env APP_ENV=dev as I know the .env is overwritten by .env.local - am I correct? – Sam Mumm Apr 21 '20 at 21:00
  • 1
    What have you tried to debug the problem? Like: dumping the environment? Can you share more details like a stacktrace that helps to locate where this error comes from? – Nico Haase Apr 23 '20 at 09:37
  • good hint looking for the complete stacktrace... it was a deprecation in the twig.yaml which I fixed while upgrading to symfony5. It is gone! – Sam Mumm Apr 24 '20 at 15:42

1 Answers1

0

Found the answer by looking deeper at the stacktrace:

[2020-04-16 23:33:35] php.CRITICAL: Uncaught Exception: The controller for URI "/robots.txt" is not callable. Controller "App\Controller\MyExceptionController" does neither exist as service nor as class.. {"exception":"[object] (InvalidArgumentException(code: ...

This is a hint to a deprecation in twig.yaml:

before:

twig: exception_controller: 'App\Controller\MyExceptionController' ...

after:

twig: exception_controller: null ...

Sam Mumm
  • 84
  • 9