简体   繁体   中英

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:

在此处输入图片说明

But get this all messed up in production:

在此处输入图片说明

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.

在此处输入图片说明

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM