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

ERRO Request error error_message="closed stream" method=get path=/v1/payment_methods #193

Open
AlanMcCann opened this issue Jul 23, 2020 · 1 comment

Comments

@AlanMcCann
Copy link

Versions
stripe-rails: 1.10.1
stripe: 5.22.0
ruby 2.6.3

After starting the rails app, I can issue successful requests one after another. If I pause for a minute and then try again, I get a message as follows

irb(main):028:0> Stripe::PaymentMethod.list({customer: "cus_xxxxxxxxxxxxxxxx", type: "card"})
INFO Request to Stripe API api_version=2019-12-03 method=get num_retries=0 path=/v1/payment_methods
ERRO Request error elapsed=0.03208500000619097 error_message="closed stream" method=get path=/v1/payment_methods

This happens with any method

This doesn't happen with the plain stripe gem.

I have tried creating a new client for each request and that has the same issue

client = Stripe::StripeClient.new
payment_methods, resp = client.request do
  Stripe::PaymentMethod.list({
    customer: "cus_xxxxxxxxxxxx",
    type: 'card',
    limit: 100
  }, $STRIPE_REQUEST_CREDENTIALS[:non_profit])
end

Any thoughts? Thanks!

@tansengming
Copy link
Owner

tansengming commented Sep 18, 2020

Did you manage to figure this out?

I just tried it out from a minimal rails install at https://github.com/tansengming/stripe-rails-dummy/tree/8da724014c48633f6ba48ca96fb0421728718eba and could not reproduce it.

As far as I know the app does not mess with the http client so I don't think the gem is causing this. I'd look into https://github.com/stripe/stripe-ruby/blob/0620436d63a40af8bdc93057c1cdb4e58bf1a30a/lib/stripe/stripe_client.rb to see how the stripe gem is handling closed streams.

Good luck!

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