You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using the api_keys gem in our Rails 8 app and everything works perfectly in development and test environments.
However, when booting the app in production mode, we encounter the following error during eager loading:
RAILS_ENV=production bin/rails c
/home/pedro/.asdf/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/activesupport-8.0.2/lib/active_support/callbacks.rb:796:in 'block (2 levels) in ActiveSupport::Callbacks::ClassMethods#skip_callback':
Before process_action callback :authenticate_api_keys_user! has not been defined (ArgumentError)
We’re not using the built-in dashboard or routes from the gem, as we’re building a custom UI using React. Also, we don’t explicitly define or call the authenticate_api_keys_user! method anywhere in our application.
The issue can be easily reproduced by running:
RAILS_ENV=production bin/rails c
It seems that the skip_before_action :authenticate_api_keys_user! call in ApiKeys::SecurityController assumes the callback was defined, which might not be the case in custom setups like ours.