Skip to content

after_stripe_event! not called after code reload #219

@heaven

Description

@heaven
include Stripe::Callbacks

after_stripe_event! do |target, event|
  Billing::Event.create!(stripe_id: event.id, kind: event.type, data: event.to_hash)
end

The code above works well after the app restart. Once I modify the code the app gets reloaded and the callback is never called again.

Can reproduce from rails console

3.1.1 :002 > ::Stripe::Callbacks::critical_callbacks
 => {"stripe.event"=>[#<Proc:0x00000001163479b8 /Users/heaven/Workspace/mdc/app/models/member.rb:30>]}
3.1.1 :003 > reload!
Reloading...
 => true
3.1.1 :004 > ::Stripe::Callbacks::critical_callbacks
 => {}

To reproduce the problem config.eager_load should be true in development.

Rails: 7.0.2
Rails env: development
Stripe: 6.5.0 (same with 6.1.0)
Stripe Rails: 2.3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions