Search code examples
javascriptruby-on-railsruby-on-rails-4herokukineticjs

Different javascript behaviour between development and production


I'm developing an application that at some point given some data draws a diagram using javascript allied with kineticJS framework.

My problem is that in development everything works fine, but in production (heroku) does not work properly.

Here is an example. Given the same input data I get this on development:

enter image description here

But get this all messed up in production:

enter image description here

I'm new at rails, I'm sure that something simple is missing, but I don't know what is missing.

I have the javascript in the asset pipeline, and they are being compiled for production.

enter image description here

Can this be caused by the pre-compilation done in the asset pipeline?

What is the best approach to debug this issues that happen in production?

I know I can use heroku logs for bugs more related with rails or ruby, but they don't help me debug this javascript different behaviour.

Any help?


Solution

  • I would personally do a rake assets:precompile locally and run your rails server in production mode, this will allow you to debug the issue locally.

    RAILS_ENV=production rails s

    If that doesn't help and you think it's a Heroku specific thing, hopefully this anecdote helps. I just ran into an issue where some of my views were using an environment variable, and found out that environment variables are not available to assets:precompile during the build phase unless you use a Heroku Buildpack.