I've got very weird problem with Rails using Spree.
Every single request is being processed twice. It's not problem with AJAX as single CURL request is also processed twice. It's not problem with logs either, as actions really takes place twice.
Problem exists only in production environment, both on Heroku and locally.
Example log:
2014-04-06T06:45:48.969394+00:00 heroku[router]: at=info method=POST path=/spree/api/orders/R657018514/line_items host=xxx.xxx.com request_id=75ac3584-f33e-48fe-b6ce-d898120f8b57 fwd="185.12.21.77" dyno=web.1 connect=0ms service=399ms status=201 bytes=1097
2014-04-06T06:45:48.952672+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/bundler/gems/spree-78f129b6d6f5/api/app/views/spree/api/orders/show.v1.rabl (120.9ms)
2014-04-06T06:45:48.959453+00:00 app[web.1]: Completed 201 Created in 381ms (Views: 93.4ms | ActiveRecord: 188.8ms)
2014-04-06T06:45:48.959460+00:00 app[web.1]: Completed 201 Created in 381ms (Views: 93.4ms | ActiveRecord: 188.8ms)
2014-04-06T06:45:48.958355+00:00 app[web.1]: Rendered vendor/bundle/ruby/2.0.0/bundler/gems/spree-78f129b6d6f5/api/app/views/spree/api/orders/show.v1.rabl (120.9ms)
Started GET "/" for 127.0.0.1 at 2014-04-06 08:55:29 +0200
Started GET "/" for 127.0.0.1 at 2014-04-06 08:55:29 +0200
Processing by Spree::HomeController#index as HTML
Processing by Spree::HomeController#index as HTML
Rendered spree/home/index.html.erb within spree/layouts/spree_application (0.8ms)
Rendered spree/home/index.html.erb within spree/layouts/spree_application (0.8ms)
Gemfile.rb:
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'newrelic_rpm'
group :assets do
gem 'sass-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'compass', '= 0.12.2'
gem 'compass-rails', '~> 1.1.2'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'sqlite3'
gem 'pry-rails'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
gem 'jquery-rails', '~> 3.1.0'
gem 'jquery-ui-rails'
gem 'handlebars_assets'
gem 'spree', :github => "methyl/spree", :require => false
gem 'spree_auth_devise', github: 'spree/spree_auth_devise'
production.rb
Aimer::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
config.static_cache_control = "public, max-age=31536000"
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = false
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
#Giannis, you were right, logs was only duplicated, and cause of double emails was somewhere else, probably in Sendgrid config.
Probably you were using heroku for deployment before, and later you started to use any other instance for deployment.
Try commenting gem 'rails_12factor' once and do bundle install, then check once.
Related
I thought this issue would be ok with assetpipeline so I ran rake assets:precompile RAILS_ENV=production then opened app on heroku but didn't work. My Gemfile is below.
ruby '2.3.0'
gem 'bootstrap-sass'
gem 'rails', '4.2.5.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'jpmobile', '~> 4.2.3'
#this gem is for users functions
gem 'sdoc', '~> 0.4.0', group: :doc
#js work on heroku by gem below
gem 'therubyracer'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
and productionrb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale shohinion use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
config.serve_static_assets = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in shohinion.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# required for heroku
#note to set this to actual host ex: { host => 'xxxxx.com'}
#config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
initializer :after_append_asset_paths,
:group => :all,
:after => :append_assets_path do
config.assets.paths << Rails.root.join('app', 'assets', 'stylesheets', 'smart_phone')
config.assets.paths << Rails.root.join('app', 'assets', 'javascripts', 'smart_phone')
end
end
I did assetspipeline commando in several ways but still didn't work. My Gemfile and production.rb are ok? If there are anything I should add or delete just teach me. I've heard this kind of issue basically comes from production.rb but I'm not sure. Just tell me if you need more files to check I will show it here.
Gemfile
source 'http://rubygems.org'
gem 'rails', '4.2.4'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'searchkick'
gem 'cocoon'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'foundation-rails'
gem 'tinymce-rails', '~> 4.3', '>= 4.3.8'
gem 'haml'
gem 'font-awesome-rails', '~> 4.6', '>= 4.6.1.0'
gem 'simple_form'
gem 'paperclip', '~> 4.3.6'
gem 'omniauth-facebook'
gem 'acts_as_votable'
gem 'masonry-rails', '~> 0.2.4'
gem 'aws-sdk', '~> 1.66.0'
gem 'foreman'
gem 'puma'
gem 'omniauth'
gem 'jquery-turbolinks', '~> 2.1'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Production.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.paperclip_defaults = {
:storage => :s3,
:s3_protocol => 'http',
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
end
Paperclip.rb
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
I am running into this error
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
Image uploading is working Perfectly fine on localhost.I don't why It is giving this error on Heroku. I checked the credentail config environment variable,they are correct.No problem with them.Even with heroku logs,Nothing else could be deduce rather than status:500. Can someone help me out to either get Full error message for heroku logs for knowing error or Let me know what is wrong with above code. Thanx a lott in advance
Here are some helpful debugging settings for your Heroku app.
In production.rb:
# More meaningful logs
config.log_level = :debug
# More meaningful error pages
config.consider_all_requests_local = true
I figured out Error by setting:
Production.rb
# More meaningful logs
config.log_level = :debug
# More meaningful error pages
config.consider_all_requests_local = true
In my case there was problem with :s3_region,I fixed it by config ENV variable for heroku
heroku config:set AWS_REGION=us-east-1
Have factory_girl_rails gem installed, runs fine on local environment, but not on Heroku. It says:
Factory not registered :user.
Any ideas or relevant files I should post for help?
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.2'
gem 'jbuilder', '~> 1.2'
gem 'jquery-rails'
gem 'turbolinks'
gem 'uglifier', '>= 1.3.0'
# server and database stacks
gem 'pg'
gem 'rails_12factor', group: :production
gem 'thin'
# template and assets stacks
gem 'bootstrap-sass'
gem 'gon'
gem 'jquery-ui-rails'
gem 'sass-rails', '~> 4.0.0'
gem 'slim-rails'
gem 'coffee-rails', '~> 4.0.0'
gem "filepicker-rails", "~> 1.0.0"
gem 'simple_form'
# authentication and authorization stacks
gem 'devise'
gem 'role_model'
# functionality stacks
gem 'state_machine'
gem 'watu_table_builder', :require => 'table_builder'
gem 'factory_girl_rails'
gem 'faker'
group :development do
gem "better_errors"
gem "binding_of_caller"
gem 'pry-rails'
gem 'quiet_assets'
end
group :development, :test do
gem 'coveralls', require: false
gem 'dotenv-rails'
gem 'rspec-rails'
gem 'guard-rspec'
gem 'rb-fchange', require: false
gem 'rb-fsevent', require: false # For Guard file detection on Mac OS X
gem 'rb-inotify', require: false
gem 'rb-readline', require: false
end
group :test do
gem 'capybara'
gem "codeclimate-test-reporter", require: nil
gem 'database_cleaner'
gem 'shoulda-matchers'
gem 'simplecov', require: false
gem 'terminal-notifier-guard' # OSX 10.8
end
group :doc do
gem 'sdoc', require: false
end
and the application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module ApplicationNew
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.time_zone = 'Singapore'
config.active_record.default_timezone = :local
config.filepicker_rails.api_key = ENV["FILEPICKER_API_KEY"]
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.enforce_available_locales = true
config.generators do |g|
g.stylesheets false
g.helper false
g.javascripts false
g.jbuilder false
g.view_specs false
end
config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**/}')]
end
end
and production.rb
ApplicationNew::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Set to :debug to see everything in the log.
config.log_level = :info
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
end
It's generally not the best idea to use factory girl in a staging or production environment even just to seed the database. Typically you would include the gem in the test and development groups only so it wouldn't even be installed as part of your heroku deploy.
Great blog post on why this isn't a good idea:
http://robots.thoughtbot.com/factory_girl-for-seed-data
my rails app working in localhost with all js files, but when i run in heroku production, that doesn't load any js files?
config/application.rb
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure
cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are
already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
config.assets.debug = false
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
config/enviornment.rb
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
application.rb
config.assets.enabled = true
application.js
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require twitter/bootstrap
//= require_tree .
Gem file
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'rest-client' , :require => 'rest_client'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'twitter-bootstrap-rails'
gem 'execjs'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem "less-rails"
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem "paperclip", "~> 3.0"
gem 'jquery-rails'
So when i run on heroku in my html head tag contains
<head>
<title>Admin70mmiq</title>
<link type="text/css" rel="stylesheet" media="all" href="/assets/application-
7bf1caf8d9df45f41b2e2de526e0a07e.css">
<script type="text/javascript" src="/assets/application-
561ebefa444229c0b9721488348e73eb.js">
<meta name="csrf-param" content="authenticity_token">
<meta name="csrf-token" content="zadsH75r/3ZNXRTijXuw7LJDNAflL/9J3DzDZJG9yi4=">
</head>
The asset pipeline compresses all js files into one file called application.js, which is visible in your HTML as /assets/application-561ebefa444229c0b9721488348e73eb.js
hi budy please do following changes in file before deploy to heroku
------enviorment.rb-----
::ActiveSupport::Deprecation.silenced = true
------Production.rb------- if any new js or css create
config.assets.compile = ['*.js', '*.css']
config.active_support.deprecation = :silence
-------application.rb-------
config.assets.enabled = true
config.assets.initialize_on_precompile = false
i used this step when deploying heroku make sure you using "postgres" database and "thin" server hope you are solve the issue.
In GemFile two gem for Heroku : postgres , thin i not see this gem in your GemFile.
My app is suddenly not working after an update. Not sure what's going wrong. Basically, when I push to heroku, I get these errors:
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
And a little higher up:
rake aborted!
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
Error
at new JS_Parse_Error (/tmp/execjs20121211-811-1z5vum.js:1720:22)
at js_error (/tmp/execjs20121211-811-1z5vum.js:1728:15)
at croak (/tmp/execjs20121211-811-1z5vum.js:2189:17)
at token_error (/tmp/execjs20121211-811-1z5vum.js:2196:17)
at unexpected (/tmp/execjs20121211-811-1z5vum.js:2202:17)
at /tmp/execjs20121211-811-1z5vum.js:2580:17
at maybe_unary (/tmp/execjs20121211-811-1z5vum.js:2665:27)
at expr_op (/tmp/execjs20121211-811-1z5vum.js:2685:45)
at expr_ops (/tmp/execjs20121211-811-1z5vum.js:2692:24)
at maybe_conditional (/tmp/execjs20121211-811-1z5vum.js:2696:28)
When I actually load up the site ("We're sorry, but something went wrong"), and look at the heroku logs, I get this:
Load path: /app
2012-12-11T23:18:13+00:00 app[web.1]: 8: <%= stylesheet_link_tag "application", :media => "all" %>
2012-12-11T23:18:13+00:00 app[web.1]: (in /app/app/assets/stylesheets/custom.css.scss)):
2012-12-11T23:18:13+00:00 app[web.1]: 6: <link href='http://fonts.googleapis.com/css?family=Kreon' rel='stylesheet' type='text/css'>
2012-12-11T23:18:13+00:00 app[web.1]: ActionView::Template::Error (File to import not found or unreadable: bootstrap.
2012-12-11T23:18:13+00:00 app[web.1]: 5: <title><%= full_title(yield(:title)) %></title>
2012-12-11T23:18:13+00:00 app[web.1]: 7: <%= favicon_link_tag 'favicon.ico' %>
2012-12-11T23:18:13+00:00 app[web.1]: 10: <%= csrf_meta_tags %>
2012-12-11T23:18:13+00:00 app[web.1]: app/assets/stylesheets/custom.css.scss:1
2012-12-11T23:18:13+00:00 app[web.1]: 11: <meta name="google-site-verification" content="idIPkgRBikSL9PCS4rVkkZfRjxYbPxNbyF6tVymBWbc" />
2012-12-11T23:18:13+00:00 app[web.1]:
2012-12-11T23:18:13+00:00 app[web.1]:
(Kreon is an additional font I added a while back that's been working fine. custom.css.scss is my main css file, and the first line is where I import bootstrap in a way that hasn't changed and has worked forever).
I searched for how to deal with the "File to import not found or unreadable: bootstrap" error, and landed on this discussion and checked out the relevant heroku troubleshoot page, but changing assets.compile to true in my production.rb file led to the heroku push errors above, and the troubleshoot page didn't seem to have much relevant to my specific problem. Not really sure what's going on here, so I'm just going to put a bunch of possibly relevant code below.
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'googlecharts', :require => "gchart"
gem 'unicorn'
gem 'newrelic_rpm'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg'
end
group :development do
gem 'sqlite3'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
end
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.9.1'
gem 'growl', '1.0.3'
gem 'guard-spork', '1.2.0'
gem 'spork', '0.9.2'
gem 'factory_girl_rails', '4.1.0'
end
gem 'annotate', '2.5.0'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'roadie'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'foreman'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
production.rb
MyApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Force all access to the app over SSL, use Strict-Transport-Security,
# and use secure cookies.
config.force_ssl = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# See everything in the log (default is :info)
# config.log_level = :debug
# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
end
The line that's really throwing me is this one in my heroku push log:
Unexpected token: operator (>) (line: 19073, col: 9, pos: 605247)
The issue, is I have no idea what file to look in for this troublesome ">". Any ideas how to read that line/col/pos nomenclature to find the actual offending code snippet?
Thanks.
STart with line 1 of app/assets/stylesheets/custom.css.scss and look for an errant >.
Also look to make sure that application.scss is what you expect.
Also just rename custom.css.scss to justcustom.scss Heck, that may do it.
Try this in the terminal:
rake assets:precompile RAILS_ENV=production --trace
Better than trying to push on heroku.
I just had the same errors.
The problem was:
the config.secret_key of devise was commented
syntax_error in a javascript file ( an "of" instead of an "in" in a for loop)
The same thing happened to me as well,
"Precompiling assets failed." while pushing to heroku,
In my development environment I had an error in my css:
".........
cursor: pointer
color: #808080;"
missing the ";" after the "pointer",
the development environment didn't mind the error,
but Heroku's PreCompile task did.
Some other Problems might be caused by duplicate named file, with "css" and "css.scss" suffixes.