integrallis / stripe_event

Stripe webhook integration for Rails applications.
https://rubygems.org/gems/stripe_event
MIT License
840 stars 107 forks source link

How to debug? #92

Closed noctivityinc closed 6 years ago

noctivityinc commented 6 years ago

We are stubbing out the event call as per the README but the routines dont appear to be working.

We have the events configured as such:

StripeEvent.configure do |events|
  events.subscribe 'invoice.upcoming', CustomerSourceCreated.new 
end

and it APPEARS that the call event is being called, which we have in app/stripe/customer_source_created.rb but the expected behavior never happens and we have no way to log what happens in the call method or debug using byebug

How can we debug these routines?

rmm5t commented 6 years ago

Sorry, you haven't really supplied enough information for someone to help you here.

the routines dont appear to be working

What routines?

the expected behavior never happens

What expected behavior?

we have no way to log what happens in the call method or debug using byebug

Why not?

Btw, please take any further questions like this to a site like StackOverflow. GitHub Issues are best reserved for discussing feature requests and bug reports.

noctivityinc commented 6 years ago

Ok - let me try this again.

There appears to be NO WAY to view any debug our log info within a subscriber object, so there is no way to debug any issues. Any puts or breakpoints using byebug are ignored.

For example, this config block:

StripeEvent.configure do |events|
  events.subscribe 'customer.subscription.trial_will_end', CustomerSourceCreated.new  
end

Should call this class, which is located inside app/stripe/customer_source_created.rb

class CustomerSourceCreated
  def call(event)
    customer = event.data.object.customer 
    user = User.find_by_stripe_id(customer)
    byebug
    puts user.id 
end

but it is FAILING and since the byebug and puts dont appear to do anything, and there is NOTHING in the test logs, other than the webhook itself being called:

Started POST "/v1/stripe" for 127.0.0.1 at 2017-08-29 14:53:43 -0400
Processing by StripeEvent::WebhookController#event as JSON

which is from this mount - mount StripeEvent::Engine, at: '/stripe'

we can't figure out what's going on, if it's our test routine or something else.

So we cannot tell if this is a BUG in StripeEvent or if this is due to StripeEvent being mounted as an engine.