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

WebhookController produces an exception in Rails 5.2+ #115

Open
gytdau opened this issue Sep 3, 2018 · 1 comment
Open

WebhookController produces an exception in Rails 5.2+ #115

gytdau opened this issue Sep 3, 2018 · 1 comment

Comments

@gytdau
Copy link

gytdau commented Sep 3, 2018

When running the Rails app in production, the WebhookController errors:
Before process_action callback :verify_authenticity_token has not been defined

As far as I can tell, this occurs in Rails 5.2 and up, since new configuration defaults were added, particularly this one:

# Add default protection from forgery to ActionController::Base instead of in
# ApplicationController.
Rails.application.config.action_controller.default_protect_from_forgery = true

which causes this if statement to be triggered in WebhookController:

if Rails.application.config.action_controller.default_protect_from_forgery
      skip_before_action :verify_authenticity_token
end

I'd try to make a pull request but I'm not sure what would fix this.

@rmm5t
Copy link
Member

rmm5t commented Sep 3, 2018

@gytdau Please do investigate. For reference, here's the PR that added this (specifically to support Rails 5.2):
https://github.com/integrallis/stripe_event/pull/107/files

More background:

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

2 participants