Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails 3.1 raise error in production env #511

Closed
timoschilling opened this issue May 11, 2011 · 13 comments
Closed

rails 3.1 raise error in production env #511

timoschilling opened this issue May 11, 2011 · 13 comments
Milestone

Comments

@timoschilling
Copy link
Contributor

Rails 3.1 raise the following error in production env:
ActionView::Template::Error (TypeError: a.reduce is not a function)

@asanghi
Copy link
Contributor

asanghi commented May 11, 2011

@timoschilling , can you please provide a gist with a complete backtrace? Also explain your scenario a bit more please.

@josevalim
Copy link
Contributor

We are also getting this on CI. It is probably an error related to the uglifier gem and/or assets pipeline. @timoschilling, please provide the full backtrace and the result of "bundle show".

@ghost ghost assigned josh May 11, 2011
@timoschilling
Copy link
Contributor Author

Setup:

  • Apache
  • Passenger 3.0.7
  • REE 1.8.7
  • Gems
  • Environment: production
    • actionmailer (3.1.0.beta1)
    • actionpack (3.1.0.beta1)
    • activemodel (3.1.0.beta1)
    • activerecord (3.1.0.beta1)
    • activeresource (3.1.0.beta1)
    • activesupport (3.1.0.beta1)
    • arel (2.1.0)
    • bcrypt-ruby (2.1.4)
    • bson (1.3.0)
    • builder (3.0.0)
    • bundler (1.0.13)
    • cancan (1.6.4)
    • capistrano (2.5.18)
    • carrierwave (0.5.3)
    • coffee-script (2.2.0)
    • coffee-script-source (1.1.0)
    • devise (1.3.4)
    • erubis (2.7.0)
    • execjs (0.3.3)
    • geocoder (1.0.0)
    • haml (3.1.1)
    • highline (1.6.1)
    • hike (1.0.0)
    • i18n (0.6.0beta1)
    • jquery-rails (1.0)
    • json (1.5.1)
    • mail (2.3.0)
    • mime-types (1.16)
    • mini_magick (1.2.5)
    • mongo (1.3.0)
    • mongoid (2.0.1 b2eaa45)
    • mongoid_acts_as_tree (0.1.7 4b0fc2d)
    • multi_json (1.0.1)
    • net-scp (1.0.4)
    • net-sftp (2.0.5)
    • net-ssh (2.1.4)
    • net-ssh-gateway (1.1.0)
    • orm_adapter (0.0.5)
    • polyglot (0.3.1)
    • rack (1.3.0.beta)
    • rack-cache (1.0.1)
    • rack-mount (0.7.2)
    • rack-ssl (1.3.2)
    • rack-test (0.6.0)
    • rails (3.1.0.beta1)
    • railties (3.1.0.beta1)
    • rake (0.8.7)
    • rdiscount (1.6.8)
    • sass (3.1.1)
    • sprockets (2.0.0.beta.2)
    • thor (0.14.6)
    • tilt (1.3)
    • treetop (1.4.9)
    • tzinfo (0.3.27)
    • uglifier (0.5.1)
    • vrame (0.6.0 77a5be8)
    • warden (1.0.4)

Log:
Started GET "/xxxx/login" for 127.0.0.1 at Wed May 11 11:11:55 +0200 2011
Processing by XXXX::SessionsController#new as
Rendered vendor/bundle/ruby/1.8/bundler/gems/xxxx-77a5be8b259d/app/views/vrame/sessions/new.html.haml within layouts/vrame (63.6ms)
[Sprockets] xxxx/xxxx.css building
[Sprockets] xxxx/xxxx.js building
Completed 500 Internal Server Error in 4174ms

ActionView::Template::Error (TypeError: a.reduce is not a function):
11:
12: %title= @page_title ? " - #{strip_tags(@page_title)}" : "XXXX"
13: = stylesheet_link_tag "xxxxx/vrame"
14: = javascript_include_tag "xxxxx/vrame"
15: %body
16: = render :partial => 'xxxx/shared/header'
17: = yield :sub_navigation

Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.beta1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.beta1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
Rendered vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.beta1/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (3.4ms)

The Error is not in the application template, the Error is with a empty template the same.

If i set the Envirement to development, every thinks works!

@spastorino
Copy link
Contributor

@timoschilling can you try changing uglifier in the Gemfile to gem 'uglifier', :git => 'https://github.com/lautis/uglifier.git' ?
I think this should work.

@ghost ghost assigned josh May 11, 2011
@spastorino
Copy link
Contributor

@timoschilling any news here?

@timoschilling
Copy link
Contributor Author

@spastorino i can test this only on the weekend

@timoschilling
Copy link
Contributor Author

now i use gem 'uglifier', :git => 'https://github.com/lautis/uglifier.git'

currently i become the error ActionView::Template::Error (TypeError: statements.reduce is not a function) in production env on the production server, running in development env works, local both env works

@josevalim
Copy link
Contributor

Could you please output the result of "ExecJS.runtime" in development and production? You need latest ExecJS and you can get that in console.

@lautis
Copy link
Contributor

lautis commented May 18, 2011

Uglifier had issues when used with therubyrhino runtime as its JS environment doesn't include some ES5 functions used in UglifyJS (Array.prototype.forEach, Array.prototype.reduce). At least therubyrhino seems to be working after lautis/uglifier@564cc9c.

If you run into similar issues with other runtimes (JScript?), please let me know so that I can fix them.

@dhh
Copy link
Member

dhh commented May 21, 2011

Can't replicate with latest uglifier. Please reopen if you can replicate.

@dhh dhh closed this as completed May 21, 2011
@timoschilling
Copy link
Contributor Author

the problem is still there in ree-1.8.7, i solve the problem for me with switching to ruby 1.9.2

@lautis
Copy link
Contributor

lautis commented May 22, 2011

Do you still get the same exception? What ExecJS runtime are you using with ree-1.8.7?

@timoschilling
Copy link
Contributor Author

the exception was the same or a little bit different. Sorry but i remove the ree environment and switch to 1.9.2

matthewd pushed a commit that referenced this issue Apr 24, 2018
Explicitly mentions the #and operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants