0

Recently I started working on a Heroku Java application.

Everything was going fine until I move the server from staging to production... (but it might be not related)

The applications uses the following buildpacks: Java Nodejs Bower

The bower is used just to install Gentelella

The problem is that now it is not loading anything from them. It seems to be correctly installed, and if I bash to the server I can see the files.

If I go via browser to /resources/style.css which is not installed via Bower, it works fine and I can see the file. If I go to /resources/bower_components/gentelella/vendors/jquery/dist/jquery.min.js, for example, it gives me 404

If I bash to the server I can see the file in the correct location and it seems to have the right permissions.

~/web/resources/bower_components/gentelella/vendors/jquery/dist $ ls -l total 296

-rw------- 1 u32669 dyno  85658 Jan 25  2017 jquery.js
-rw------- 1 u32669 dyno  85578 Jan 25  2017 jquery.min.js
-rw------- 1 u32669 dyno 129572 Jan 25  2017 jquery.min.map

I've cleaned my cache, restarted dynos and other silly "solutions".

Any other idea what else it could be?

UPDATE

Found out that the actual place that files are being served is: target/tomcat./webapps/expanded/resources

Copied all the bower_components to this folder as a temporary solution and now it is working fine, but I want to understand why is this happening.

So I think I need to set this as the right path somewhere else in Heroku settings or somewhere else?

dfranca
  • 5,156
  • 2
  • 32
  • 60

1 Answers1

0

The problem was related to the order of the buildpacks.

When the Java buildpack runs it copies the web resources to the Tomcat public directory. What was happening is that the Java buildpack was running first, so the bower installation was never copied to the correct directory.

Just changing the order to make the Java buildpack the last one to run fixed it.

dfranca
  • 5,156
  • 2
  • 32
  • 60