2
votes

We are trying to deploy our symfony project to Heroku. The build is passing correctly even though when we try to access the project page all we can see is a blank page.

Herolku logs show :

PHP Warning: file_get_contents(/tmp/build_7d6abc3e08fd2bf7205da28ab2e4181d/Path/to/home/home.html.twig): failed to open stream: No such file or directory in /app/vendor/twig/twig/lib/Twig/Loader/Filesystem.php on line 131

We already tried to clear the cache in prod.

For info, here is the "script" part of our composer.json :

"scripts": {
    "post-root-package-install": [
        "SymfonyStandard\\Composer::hookRootPackageInstall"
    ],
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "compile": [
        "php app/check.php",
        "echo \"DELETING app_dev.php\"",
        "rm web/app_dev.php",
        "echo \"DELETING app/cache/*\"",
        "rm -rf app/cache/*",
        "composer install --no-dev --optimize-autoloader",
        "echo \"CACHE CLEAR\"",
        "app/console cache:clear --env=prod --no-debug",
        "echo \"CACHE WARMUP\"",
        "app/console cache:warmup --env=prod --no-debug",
        "app/console assetic:dump --env=prod --no-debug"
    ]}

We are using symfony 2.7

Any help is appreciated. Thanks

2
in /APP/vendor/ ? Is it normal /app/ ? - Roukmoute
@Roukmoute Yes, it is. Heroku puts your application in it's own app directory. - Eugene Nezhuta

2 Answers

0
votes

For futur reference, the problem was finally solved by updating each bundles to their latest versions in composer.son.

0
votes

For those who still havnt solved it-

I have solved this issue by giving the path for installing the symfony assets

php app/console assets:install web --env=dev

In heroku the assets were installed into the tmp folder by default. So I had to specifically tell the script to install them in to the web folder only.

Following is my composer script

"scripts" : {
        "symfony-scripts" : [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd" : "@symfony-scripts",
        "post-update-cmd" : "@symfony-scripts",
        "compile" : [
            "php app/console assets:install web --env=dev",
            "php app/console assetic:dump web --env=dev",
            "rm -rf app/cache/*"
        ]
    },

hope this helps