In Rails 3.1, ActionView::Template::Error (file name too long...) #3348

Closed
kurko opened this Issue Oct 17, 2011 · 8 comments

Projects

None yet

4 participants

@kurko
kurko commented Oct 17, 2011

I'm getting an error in production. It's similar to #138. It's happening only in production, not in development.

In my point of view, I did nothing that could cause the error. It was working fine, then I improved my tests, refactored a JS file today and redeployed.

The problem

Now I get this:

ActionView::Template::Error (File name too long - /var/rails/primero/releases/20111017013943/app/assets/images/form .columns {
  display: table;
  clear: both;
  margin: 0 0 10px 0; }

input:focus {
  background: #f1f1f1;

(...almost whole css file is output...)

/* inline_form FORMS *):
    2: <html>
    3: <head>
    4:      <title><%= @company_name %><%= if yield(:title).blank?; ""; else ": "+yield(:title); end %></title>
    5:      <%= stylesheet_link_tag "manifest_application" %>
    6:  <%= javascript_include_tag "manifest_application" %>
    7:  
    8:  <% # params[:controller] = 'deals'; %>
  app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___561691512_94090930'

The whole log is here: http://pastie.org/2709138

Upon deployment, I'm running assets:precompile (via capistrano). Everything was fine yesterday.

What I did trying to solve

  • I commented line 5 (loading css), and the error went to the line 6 (js).
  • Gemfile: gem 'sprockets', :git => 'https://github.com/sstephenson/sprockets.git'
  • Deployed from another branch, which has code from 2 days ago, and everything started working again. I presume something's wrong with my code, but I really did nothing, just refactored a JS file (and created some RSpec specs). How could source code throw in error 'file name too long'?

Have no clue what else I could do.

My environment

# environments/production.rb

config.serve_static_assets = false
config.assets.compile = true
config.assets.digest = true

So, could anyone help me? I found nothing similar on Google, only #138 (which is not an ActionView::Template error).

@macmartine
Contributor

I was hitting this a few days ago as well, and having similar frustrations. I'm now racking my brain to remember what caused it. I think it might have simply been upgrading to 3.1.1 that fixed it. What version are you using?

@kurko
kurko commented Oct 17, 2011

It's 3.1.1, unfortunately.

@macmartine
Contributor

Do you have 'config.assets.debug = true' in production.rb? If so, comment it out, or set it to false. Let me know if that does it.

@kurko
kurko commented Oct 17, 2011

Oh, it worked! It was set to true in application.rb, so I missed that out.

Thank you @macmartine.

Anyway, something should be done about it, as others will certainly face it.

@macmartine
Contributor

Excellent, so glad it worked. And I agree that it should be fixed -- I spent days trying to narrow it down.

@kurko
kurko commented Oct 18, 2011

Sorry, I can't disclose mine.

However, here's the css which was raising the problem: http://pastie.org/2716093

Remember, it's happening only in production. In development, even if config.asset.debug = true, it runs just fine.

@macmartine Just in case, the same discussion is happening on #3333.

@guilleiguaran guilleiguaran added a commit to guilleiguaran/rails that referenced this issue Dec 10, 2011
@guilleiguaran guilleiguaran Use ProcessedAsset#pathname in Sprockets helpers when debugging is on…
…. Closes #3333 #3348 #3361.

Is wrong use ProcessedAsset#to_s since it returns the content of the file.
7a7e87d
@guilleiguaran
Member

Closed with #3932

@guilleiguaran guilleiguaran added a commit to guilleiguaran/rails that referenced this issue Dec 20, 2011
@guilleiguaran guilleiguaran Use ProcessedAsset#pathname in Sprockets helpers when debugging is on…
…. Closes #3333 #3348 #3361.

Is wrong use ProcessedAsset#to_s since it returns the content of the file.
d7fbd63
@timbur
timbur commented Sep 3, 2015

Thanks for this issue lol. Just saved me a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment