I have an application developed with Symfony 5, which is working fine in my local environment (Vagrant running Laravel Homestead box), but when I deploy it to the live server it crashes with an empty white page and responds with 500 Internal Server Error.
When I SSH into the server and manually change the
APP_ENV variable’s value to
prod inside my .env file, I can see the error:
Attempted to load class "WebProfilerBundle" from namespace "SymfonyBundleWebProfilerBundle".
Did you forget a "use" statement for another namespace?
I’m using Github Actions to deploy my application and in my action I’m installing the PHP dependencies like this
- name: Install dependencies run: | export APP_ENV=prod composer install --no-dev --optimize-autoloader
So I don’t want development only dependencies in my production server, hence the
--no-dev flag, and if I understand correctly the WebProfilerBundle is used for inspecting the request in development, so it’s indented to be used only in the
Why does Symfony think it has to load this bundle?
Also, I supposed to have my custom error pages configured for 404 and 500 errors (adding a
bundles/TwigBundle/Exception/error.html.twig file under the
templates folder), why isn’t my custom error page shown? Why am I getting an empty white page?
I’m suspecting it’s something with the way I’m deploying (since it work on my local machine).
I’ve tired removing the flags from the composer install (so just running
composer install as is), but that also resulted in an error.
The app’s supposed to run on this domain: https://thebedechkacase.com/
Source: Symfony Questions