Search code examples
phpgoogle-cloud-platformsymfony4

Deploying Symfony 4.2 On Google Cloud


I'm trying to deploy Symfony 4.2 on Google Cloud. Using this tutorial: https://cloud.google.com/community/tutorials/run-symfony-on-appengine-flexible

It deploys without errors, but when I try to access it gives me 500. Logs from Google:

2019-02-20 07:53:36 default[20190220t093729]  #0 /app/vendor/symfony/http-kernel/Config/FileLocator.php(52): Symfony\Component\Config\FileLocator->locate('../src/Controll...', '/app/config', true)
2019-02-20 07:53:36 default[20190220t093729]  #1 /app/vendor/symfony/config/Loader/FileLoader.php(110): Symfony\Component\HttpKernel\Config\FileLocator->locate('../src/Controll...', '/app/config', true)
2019-02-20 07:53:36 default[20190220t093729]  #2 /app/vendor/symfony/dependency-injection/Loader/FileLoader.php(126): Symfony\Component\Config\Loader\FileLoader->glob('', true, NULL, false, false, Array)
2019-02-20 07:53:36 default[20190220t093729]  #3 /app/vendor/symfony/dependency-injection/Loader/FileLoader.php(57): Symfony\Component\DependencyInjection\Loader\FileLoader->findClasses('App\\Controller\\', '../src/Controll...', Array)
2019-02-20 07:53:36 default[20190220t093729]  #4 /app/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(554): Symfony\Component\DependencyInjection\Loader\FileLoade" while reading response header from upstream, client: 172.17.0.4, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "placechecker-231507.appspot.com"
2019-02-20 07:53:36 default[20190220t093729]  172.17.0.4 - - [20/Feb/2019:07:53:36 +0000] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) snap Chromium/72.0.3626.96 Chrome/72.0.3626.96 Safari/537.36"
2019-02-20 07:54:36 default[20190220t093729]  2019/02/20 07:54:36 [info] 9#9: *6 client 172.17.0.4 closed keepalive connection

I tried the other existing tutorial which installs a demo symfony application, which is not exactly what I want, but it almost works, except it doesn't load CSS and JS. https://cloud.google.com/community/tutorials/run-symfony-on-appengine-standard

Any ideas how to debug this would be helpful.

EDIT:

After deploying in dev mode I'm getting this error:

(1/1) ClassNotFoundException
Attempted to load class "WebProfilerBundle" from namespace "Symfony\Bundle\WebProfilerBundle".
Did you forget a "use" statement for another namespace?

in Kernel.php line 23
at Kernel->registerBundles()
in Kernel.php line 424
at Kernel->initializeBundles()
in Kernel.php line 130
at Kernel->boot()
in Kernel.php line 193
at Kernel->handle(object(Request))
in index.php line 25

Solution

  • The biggest helper to help to figure out what is wrong with the project was adding:

    APP_DEBUG: 1
    

    Which allows to start showing error messages.