20

So I did some CSS changes on my local, ran git add ., git commit -am "Hello", git push heroku master, and for some reason two commmits ago, things stopped getting updated.

It commits fine, and doesn't show any input out of the ordinary.

I tried making a new branch and pushing it to the heroku branch, but still nada. What gives?

Louis93
  • 3,843
  • 8
  • 48
  • 94
  • 1
    What does `git status` say? Also, does it push to GitHub (or other remote endpoint) correctly? I occasionally get off the tracks when stashing and reverting to earlier versions. – prototype Mar 24 '14 at 03:05
  • It does push to other endpoints correctly. I'm able to push it to GitHub fine. `git status` says # On branch master nothing to commit, working directory clean – Louis93 Mar 24 '14 at 03:09
  • 1
    I wonder if the CSS is actually updated on Heroku but maybe the browser is caching the css. Try from a different machine or browser? Is it on GitHub? As one check, actually go to GitHub.com repo and see if the CSS change is there. I don't know if one can view the source on Heroku's git repo. – prototype Mar 24 '14 at 03:13
  • 1
    Did you run the Heroku command collect static? After the first push static files need to manually collected for them too update the previous version. – agconti Mar 24 '14 at 03:16
  • I have cache-ing disabled. I checked the sources after they loaded to ensure this was happening. The CSS change exists on GitHub. – Louis93 Mar 24 '14 at 03:16
  • Just saw this force option in last answer on this post: http://stackoverflow.com/questions/6104258/how-to-reset-heroku-app-and-re-commit-everything?rq=1. – prototype Mar 24 '14 at 03:17
  • @agconti collectstatic looks like a python thing? I couldn't find a link describing it. How do I run it? – Louis93 Mar 24 '14 at 03:19
  • Sorry, I was looking at `git push --force heroku master` and `git push heroku +master`. I haven't used either, but they may be useful. – prototype Mar 24 '14 at 03:22
  • @Louis93 What did you build your app in? It is a python thing, but many frameworks do something similar when they're set up for production environments. – agconti Mar 24 '14 at 03:25
  • @agconti Ruby on Rails – Louis93 Mar 24 '14 at 03:29
  • @user645715 I tried both, neither provided different results – Louis93 Mar 24 '14 at 03:36
  • Can you please delete the browser history and then try. Or press Ctrl+F5 on your browser. As it might be a case of not reloading the new CSS by browser. – anuragal Mar 24 '14 at 04:09
  • Just nuked browser history - nothing changed. – Louis93 Mar 24 '14 at 11:54
  • Try using [`heroku releases` and then `heroku releases:info` with the latest version that you see](https://devcenter.heroku.com/articles/releases#listing-release-history). Make sure the Git commit id (see "Change") is what you expect. – ChrisGPT was on strike Mar 24 '14 at 15:59
  • 2
    Hey did you find a solution to this? – aliasav Jan 28 '16 at 09:59

12 Answers12

25

Make sure your local branch is master. If you're using a different local brach then you have to use.

git push heroku your_local_branch_name:master
Adam Mendoza
  • 5,419
  • 2
  • 25
  • 31
  • 1
    This ^^ . ``Heroku only deploys code that you push to the master or main branches of the remote. Pushing code to another branch of the heroku remote has no effect`` [Reference](https://devcenter.heroku.com/articles/git#deploy-your-code) –  Mar 01 '22 at 15:01
21

Try running 'heroku releases' and 'heroku ps' on the command line.

heroku releases should show you which git version Heroku currently has running -- this will let you compare your local git revision to the one Heroku has, to ensure it actually received your updates.

Next, you might want to check heroku ps, and verify your app is running as expected.

Lastly, if all else fails, try running heroku run bash, and looking at the files Heroku has on your Dyno, if it doesn't add up -- email Heroku support!

rdegges
  • 32,786
  • 20
  • 85
  • 109
  • 2
    Hey so I checked `heroku run bash`, and to my surprise the CSS on there is updated, while the website continues to serve the outdated CSS file! – Louis93 Mar 25 '14 at 01:37
  • So frustrating gah - thanks, I'll email Heroku support – Louis93 Mar 25 '14 at 01:39
  • if its some sort of Angular app running on Express you should definitely check about ng build --prod and guarantee that the final JS is on the server. I mean adding the final outcome compiled to git is the reason my app wasn't being updated. – JBarros35 Feb 16 '21 at 19:12
  • 1
    Just a reminder if you are like me using `django` and `react` you also have to commit the build files before git pushing to the `heroku` upstream :) – Ayush Nov 10 '21 at 09:04
  • @Ayush that solved it for me, thanks! – Undefined Dec 04 '21 at 15:14
10

If your domain uses Cloudflare DNS, try to "Purge Cache" from the Cloudflare account.

Intteco
  • 101
  • 1
  • 2
8

If your code is correctly deployed as shown from heroku releases, you can try to purge the cache and force a fresh build. See https://help.heroku.com/18PI5RSY/how-do-i-clear-the-build-cache

$ heroku plugins:install heroku-repo
$ heroku repo:purge_cache -a appname

The cache will be rebuilt on the next deploy.

$ git commit --allow-empty -m "Purge cache"
$ git push heroku master
Ken H
  • 601
  • 8
  • 6
2

Had this issue also. Changes to CSS made in Github repo were not reflected in heroku app. Hard reload of the app solved problem.

Hard reload with ctrl + F5. Hard reload bypasses the cache. You can also hard reload by opening up developer tools in your browser (F12) and right clicking on the refresh button.

Gaël J
  • 11,274
  • 4
  • 17
  • 32
2

I had this problem recently as well. If you've tried the main troubleshooting steps, it might be similar to what Brett84c said - the build process is not being followed properly.

For example, this website recommends that you insert the following block of code into your backend express app's index.js file in order to serve static files from a pre-built folder.

// ... other app.use middleware 
app.use(express.static(path.join(__dirname, "client", "build")))

// ...
// Right before your app.listen(), add this:
app.get("*", (req, res) => {
    res.sendFile(path.join(__dirname, "client", "build", "index.html"));
});

However, this means that you must ensure that the build folder it is serving that is located in the backend folder has actually been updated (re-built) each time you make changes to the "client" frontend React app.

1

Try running:

bundle exec rake assets:precompile

Then gitting:

git add . 
git commit -m "asdfasdf" 
git push heroku master
Nicole Hemenway
  • 563
  • 5
  • 13
0

I had this issue this morning, and I couldn't figure it out. I looked at the files on the instance, and they were correct, but the site was still serving up the old version.

My solution, delete the instance and start over. The new instance was responding appropriately to git push, so this makes me think that there could be a deeper issue in heroku's infrastructure.

danclark
  • 91
  • 2
  • 10
0
  1. Delete bundle.js
  2. run node build.js
  3. commit and git push origin master
  4. git push heroku master
0

In my case I was forgetting to perform mvn clean install before commiting.

-1

So I was trying to push my React app to Heroku and could not figure out why the code wasn't updating even though my original git repo showed the changes while I pushed that same code to Heroku directly after. Turns out I forgot to handle the building process for my app code first before committing the changes.

HaulinOats
  • 3,628
  • 4
  • 21
  • 24
-2

Try opening it in another browser or in incognito because it could be cached in your current browser to serve the old files.