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

Page Caching - Errno::EACCES (Permission denied @ dir_s_mkdir - /api) #49

Closed
AankTia opened this issue Nov 6, 2018 · 1 comment
Closed

Comments

@AankTia
Copy link

AankTia commented Nov 6, 2018

Hi, I'm trying to used page caching for my API app with Rails 5.2.1 and actionpack-page_caching 1.1.1,
In ApplicationController if inherit from ActionController::Base, no problem found for cache page,
But if I used ActionController::API, I got error when cache_page like this:

Errno::EACCES (Permission denied @ dir_s_mkdir - /api):
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:232:in mkdir' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:232:in fu_mkdir'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:210:in block (2 levels) in mkdir_p' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:208:in reverse_each'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:208:in block in mkdir_p' /usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:193:in each'
/usr/share/rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/fileutils.rb:193:in mkdir_p' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:167:in write'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:80:in block in cache' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:176:in block in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in block in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:176:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:79:in cache' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:282:in cache_page'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-page_caching-1.1.1/lib/action_controller/caching/pages.rb:231:in block in caches_page' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in instance_exec'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in block in make_lambda' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:236:in block in halting_and_conditional'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in block in invoke_after' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in each'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:517:in invoke_after' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:133:in run_callbacks'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in process_action'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in block in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in block in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in instrument' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in instrument'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in process_action' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in process_action'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in process'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:255:in block (2 levels) in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:42:in block in running'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/concurrency/share_lock.rb:162:in sharing' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/activesupport-5.2.1/lib/active_support/dependencies/interlock.rb:41:in running'
/home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:247:in block in process' /home/tia/.rvm/gems/ruby-2.5.1@api_project/gems/actionpack-5.2.1/lib/action_controller/metal/live.rb:291:in block in new_controller_thread'

In my ApplicationController:

class ApplicationController < ActionController::API
    include ActionController::RequestForgeryProtection
    include ActionController::Caching

what should I do?

@AankTia
Copy link
Author

AankTia commented Nov 6, 2018

in ApplicationController, just add:

self.page_cache_directory = PAGE_CACHE_PATH

Related to:
Caching issue

@AankTia AankTia closed this as completed Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant