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

Errno::EACCES: Permission denied in Production #7

Closed
agibralter opened this issue Nov 27, 2009 · 5 comments
Closed

Errno::EACCES: Permission denied in Production #7

agibralter opened this issue Nov 27, 2009 · 5 comments

Comments

@agibralter
Copy link
Contributor

Instead of getting 404s in production, I'm getting 500s due to Errno::EACCES.

Errno::EACCES: Permission denied - /home/rails/myapp/releases/20091127033835/public/assets/anything.css
Errno::EACCES: Permission denied - /home/rails/myapp/releases/20091127033835/public/assets/anything.js

etc...

Here is a backtrace:

/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/jammit-0.2.4/lib/jammit/packager.rb:56:in `initialize'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/jammit-0.2.4/lib/jammit/packager.rb:56:in `open'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/jammit-0.2.4/lib/jammit/packager.rb:56:in `cache'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/jammit-0.2.4/lib/jammit/controller.rb:37:in `cache_package'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `send'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in `evaluate_method'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:in `call'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/actionpack-2.3.4/lib/action_controller/filters.rb:662:in `run_after_filters'
/home/rails/myapp/releases/20091127033835/vendor/bundler_gems/gems/actionpack-2.3.4/lib/action_controller/filters.rb:619:in `call_filters'

Any thoughts?

@documentcloud
Copy link
Collaborator

Yep. You need to make sure that when you run the jammit command on the server, you run it as the same user as your webserver. Probably www-data or nobody -- otherwise when it tries to cache asset packages into the jammit-generated public/assets folder, it won't have permission.

If that helps you any, write back and we'll close this ticket. I'll put it on the list to add a better "directory not writable" exception for the next release.

@agibralter
Copy link
Contributor Author

Oh, hmm, strange. I deploy with Capistrano and run jammit when deploying. You're right -- my public/assets is root:root, not rails:rails...

But just to be clear, before I meant when someone requests an asset that doesn't actually exist... i.e. when someone requests something.js and something.js doesn't exist, Jammit is producing the EACCES... Why is Jammit trying to open/bundle a file that isn't even listed in assets.yml?

@documentcloud
Copy link
Collaborator

Nice bug catch -- it's not actually trying to open the bundle. Jammit returns a 404 when you request an asset package that isn't defined. Unfortunately, the after filter is trying to cache that 404 page. I'll get it fixed, along with the better error message, for 0.3.1.

@agibralter
Copy link
Contributor Author

Ah interesting. Thanks again!

Also noticed a few more instances of RAILS_ENV in the code... I think it might become deprecated in future Rails releases.

@documentcloud
Copy link
Collaborator

Jammit 0.3.1 is out. It includes an OutputNotWritable error for locked directories, the removal of the after_filter -- 404 pages won't be cached any more. And all remaining traces of RAILS_ENV have been cleaned up. Closing the ticket.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant