-
Notifications
You must be signed in to change notification settings - Fork 123
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
undefined method `data' for []:Array #178
Comments
Hi @wonderer007 do you have more information about the webhook? It'll be great to have a payload to help with debug. How are you triggering the webhook? |
I'm seeing the same issue in our application.
API Version: config.stripe.api_version = '2019-09-09' Here's the raw stacktrace:
|
Hi @wonderer007 and @aarhusgregersen I've added some code on #181 to dump some debugging information to try to figure this out. Can you update your gem 'stripe-rails', git: 'https://github.com/tansengming/stripe-rails', branch: 'feature/request-debug' and let me know what it's showing on the log when the error happens? The log should look something like:
|
@tansengming thank you for getting back to me/us! |
No worries @aarhusgregersen thanks for the update. I'll try to see if I can fix that error message. |
More notes: when I tried using a webhook with an incorrect signing secret, the logs returned "No signatures found matching the expected signature for payload". So I still can't recreate the error.
|
I'm sorry @tansengming I wish I could be of more help. I wish I remember what we changed to fix it, but I already forgot 😓 |
@aarhusgregersen no worries! I'm gonna keep this issue open in case other folks are seeing this. Hopefully we'll get to the bottom of this one day. |
I can shed some light on this since I ran into the same issue. The problem isn't having the wrong signing_secret but rather having a nil signing_secret. In my code I was setting signing_secret (not signing_secrets) this way:
However, in development I don't have that variable set in my secrets configuration so it's akin to writing:
Now when the stripe-rails devs changed to signing_secrets they maintained a method to set signing_secret= for compatibility:
retrieve_stripe_event in app/models/stripe/event_dispatch.rb checks for the existence of signing_secrets to determine whether to process the webhook data as is or to ask Stripe for the data through the API:
You'd think that if I'd suggest adding a guard clause to
I'm not sure if that would have other knock on effects so modifying the if condition in retrieve_stripe_event could be good enough. TL;DR: Make sure you set Edits: The number of times I wrote singing_secret astounds me. At least it sounds nice. |
thanks a bunch @martron this makes a lot of sense! I'll be happy to merge any PR you want to make with your suggested changes, I think it should work! |
Stripe webhook call
POST /stripe/events
resulting in crash
ruby
2.3.3stripe
5.14.0stripe-rails
1.9.1The text was updated successfully, but these errors were encountered: