heroku-cl-example
heroku-cl-example copied to clipboard
Can't find public directory.
The public directory for loading images/assets seems not to be working and is crashing the app when deployed on heroku.
The error reported in the logs is: Error: File "./public/" does not exist. Any ideas on how to solve this? For now I don't need images so I've commented out the publish-directory call in initialize-application.
Short answer: no.
Long answer: I had a terrible time trying to get all the pathnames to come out right in the cl buildpack, and it appears that my eventual kludgy solution is not stable over whatever changes the heroku elves are doing to their infrastructure.
Unfortunately I don't have time to dive back into this now.
On Fri, Nov 16, 2012 at 12:16 PM, Quinn Jarrell [email protected]:
The public directory for loading images/assets seems not to be working and is crashing the app when deployed on heroku.
The error reported in the logs is: Error: File "./public/" does not exist. Any ideas on how to solve this? For now I don't need images so I've commented out the publish-directory call in initialize-application.
— Reply to this email directly or view it on GitHubhttps://github.com/mtravers/heroku-cl-example/issues/2.
Alright, I'll take a deeper look this week and see if I can fix it. Thanks for your response.
Why the error happens is obvious: the application tries to access directory the "./public/" - the one present in the git repository.
But the buildpack doesn't copy the source code to BUILD_DIR. It only places CCL binary and the application image file there. So the "./public/" directory is absent at run-time.
Found the fix. Changed the "./public/" to "/app/public".
Found this solution in this application: https://github.com/jsmpereira/heroku-cl-example. Don't know yet how reliable it is. I.e. whether it is guaranteed by Heroku that the application sources will always be copied to slug to the directory /app/. Discussing this here: https://github.com/jsmpereira/heroku-cl-example/issues/2
Discuessed on #heroku at freenode.net with @jsmpereira and @yfeldblum.
We think that referring the /app/ directly is not 100% reliable, as heroku may change it in the future. Expecting the git repository content to be available in the current directory is more reliable, according to @yfeldblum.
But I've added logging to the initialization of the lips application. (ccl:current-directory) returns "/app/". Therefore it's strange "./public/" doesn't work while "/app/public/" work.