Assets for heroku deploy

Hello! I am preparing an app for deployment on Heroku. There is a huge bunch of stuff in ./assets What do I really need? I have a default install of Phoenix.

Hi there! Phoenix’s default gitignore file should ignore all the files that are not needed for deployment. There’s an official guide here that should provide you with all the information you need: https://hexdocs.pm/phoenix/heroku.html

I think the problem is that I didn’t use the --no-brunch --no-html option when I set things up. Heroku is asking for an assets folder.

Deployment with Heroku should be OK with or without brunch/html/assets.

Are you getting an error message somewhere? Could you share the exact steps you are using and any error messages you are getting in return? Thanks.

Give me a sec. I think I need to remove the phoenix buildpack, then the assets folder

Oops, there is more to it than that. According to the docs, I don’t need the phoenix buildpack if the app was set up with --no-brunch --no-html, which is what I should have done. I don’t know how to get back to that state.

Here is the error message:

----> Installing binaries
remote:        Using cached node 6.9.2...
remote:        Installing Node 6.9.2...
remote:        Using default npm version
remote:
remote: -----> Building dependencies
remote:        Installing and caching node modules
remote: /app/tmp/buildpacks/abc8fb9e8be131ec2574c4ba9e31b81540d97b3bbce47d96e05959c4f81404ac71605dd35ebbcf7a1abe958c346d8ee266ff035de9254424eb54e8b9480059be/lib/build.sh: line 119: cd: /tmp/build_19c82052969208750d0c1cfcdb7ecfd6/./assets: No such file or directory
remote:  !     Push rejected, failed to compile Phoenix app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !	Push rejected to sleepy-thicket-56112.

Heroku is trying to compile node.

When I run the app locally, it runs fine despite the error message

[info] Running LogServerWeb.Endpoint with cowboy 2.6.1 at 0.0.0.0:4000 (http)
[error] Could not start node watcher because script "/Users/carlson/dev/apps/LoggerProject/log_server/assets/node_modules/webpack/bin/webpack.js" does not exist. Your Phoenix application is still running, however assets won't be compiled. You may fix this by running "cd assets && npm install".
[info] Access LogServerWeb.Endpoint at http://localhost:4000
Interactive Elixir (1.7.4) - press Ctrl+C to exit (type h() ENTER for help)

I found this item on how to remove a Heroku buildpack, perhaps this will help https://devcenter.heroku.com/articles/buildpacks#removing-a-buildpack-from-an-app

3 Likes

Thanks! I used the instructions in the article and the app now builds. Had you clear, then reinstall the elixir buildpack.

2 Likes

if its an API first project, then there is no need of GitHub - gjaldon/heroku-buildpack-phoenix-static: A Heroku buildpack for building Phoenix's static assets buildpack

This buildpack is only necessary when you need to compile static assets during deploys. You will not need this buildpack if you are using Phoenix only as a REST API.