Louis93
Louis93

Reputation: 3923

Heroku is not updating my code?

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?

Upvotes: 20

Views: 32874

Answers (12)

Andrew David Brown
Andrew David Brown

Reputation: 21

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.

Upvotes: 2

Ankit singh
Ankit singh

Reputation: 1

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

Upvotes: -2

user6752231
user6752231

Reputation:

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

Upvotes: 0

swolephysicist
swolephysicist

Reputation: 21

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.

Upvotes: 2

HaulinOats
HaulinOats

Reputation: 3878

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.

Upvotes: -1

Ken H
Ken H

Reputation: 641

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

Upvotes: 8

Jonathan Poischen
Jonathan Poischen

Reputation: 1

  1. Delete bundle.js
  2. run node build.js
  3. commit and git push origin master
  4. git push heroku master

Upvotes: 0

danclark
danclark

Reputation: 111

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.

Upvotes: 0

Intteco
Intteco

Reputation: 111

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

Upvotes: 11

Nicole Hemenway
Nicole Hemenway

Reputation: 593

Try running:

bundle exec rake assets:precompile

Then gitting:

git add . 
git commit -m "asdfasdf" 
git push heroku master

Upvotes: 1

Adam Mendoza
Adam Mendoza

Reputation: 5903

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

Upvotes: 25

rdegges
rdegges

Reputation: 33824

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!

Upvotes: 21

Related Questions