question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with JS not working on Heroku

See original GitHub issue

When including gem 'gentelella-rails'. JS works fine on local but stops working on Heroku. i followed all the instructions. Using rails 5.1.2. Works fine if i remove gentelella-custom.js file.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mwlangcommented, Jul 21, 2017

turned out there were a total of three separate issues to resolve along the way.

1st: moment.js is required for fullcalendar. This has been added to the gem’s asset pipeline. Why it didn’t cause issues in development mode is a mystery!

2nd: It wasn’t enough to add just “gentelella.js” to the gem’s precompile list to fully build out the asset pipeline. This was prompting everyone to add *.js and *.css to their project’s precompile list.

3rd: datejs-rails is dormant, and has encoding issues that are unresolved since 2014, so I switched to bower to get latest sources.

To fix your project:

bundle update gentelella-rails

To get to the latest release of the gem. 0.1.8 at the time of this note.

REMOVE Rails.application.config.assets.precompile += %w( *.js *.css ) from your Rails project. If this line is left in, you’ll start see a whole new set of issues when it gets to bootstrap-sass gem. The long/short of it: adding that line to the gem pulled in exactly the right *.js and *.css that the gem depends on to work. Adding it to the Rails project pulls in every *.js and *.css of every gem in the Rails app and this gets messy quick!

Here’s a working Heroku deploy: https://stormy-shore-66376.herokuapp.com/index.html This is just the Rails 5.1.x example tweaked to use ‘pg’ gem. I will likely delete the Heroku dyno in a couple weeks, so check it out while you can.

2reactions
mwlangcommented, Jul 21, 2017

@b-mandelbrot: That data/da-DK.js failing on invalid byte sequence seems to be a clue that there’s a problem encoding and compressing the JS with. However, I’m able to follow your steps and precompile everything on the demo rails project. Can you try to reproduce this with the demo?

@Talha5 node_modules could contain anything. Are you geting the same error writing da-DK-[fingerprint].js.gz? That is, the Encoding::InvalidByteSequenceError that @b-mandelbrot reports?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Node.js Deploys - Heroku Dev Center
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack.
Read more >
ruby on rails - Javascript not loading on heroku - Stack Overflow
My javascript is loading perfectly on development but it's not loading on the production. Even I am not getting any error in production....
Read more >
javascript fails on Heroku, but fine locally
Again, it all works fine except on Heroku. Behavior suggests that the algo is failing in the regex area or in the random...
Read more >
JavaScript fails on a fresh Rails App deployed to Heroku
I think there is a big problem with JavaScript files in Rails 5 apps in Production environment on Heroku. Steps to reproduce. Step...
Read more >
Deploying a Back-End with Heroku - Codecademy
It's likely, at some point, that you run into an error when Heroku attempts to deploy your app. And even after successful deployments,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found