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

V13 service-based call pattern doesn't respect Stripe.* global config #1511

Open
mebezac opened this issue Jan 2, 2025 · 0 comments
Open
Labels

Comments

@mebezac
Copy link
Contributor

mebezac commented Jan 2, 2025

Describe the bug

The migration guide says:

For configurable options that are not specified or not currently available on StripeClient, we fall back to the global StripeConfiguration

However that doesn't seem to be the case.

To Reproduce

  1. Set a global config that is available in StripeConfiguration but not on StripeClient, for example open_timeout to something absurdly low like 0.00001
  2. Attempt a request using the resource-based call: Stripe::PaymentIntent.retrieve('pi_ID)
    • That fails because the open_timeout is so low
  3. Spin up a new client c = Stripe::StripeClient.new(YOUR_KEY, stripe_version: YOUR_VERSION) and attempt the same action c.v1.payment_intents.retrieve('pi_ID)
    • It doesn't fail because it's ignoring the open_timeout config.

Expected behavior

I'd expect the new StripeClient to fall back to the global StripeConfiguration for any options that "are not specified or not currently available" as the docs say should happen.

Code snippets

Stripe.api_key = YOUR_KEY
Stripe.api_version = YOUR_VERSION
Stripe.log_level = 'debug'
Stripe.open_timeout = 0.00001

Stripe::PaymentIntent.retrieve('pi_3QUbknF2v1Yns8Jb0n84xrPS')
# INFO Request to Stripe API api_version=2024-06-20 method=get num_retries=0 path=/v1/payment_intents/pi_3QUbknF2v1Yns8Jb0n84xrPS
# DEBU Request details query= process_id=1 thread_object_id=8400 log_timestamp=93314.979633254
# ERRO Request error elapsed=0.0117530230054399 error_message="Failed to open TCP connection to api.stripe.com:443 (execution expired)" method=get path=/v1/payment_intents/pi_3QUbknF2v1Yns8Jb0n84xrP

c = Stripe::StripeClient.new(YOUR_KEY, stripe_version: YOUR_VERSION)
c.v1.payment_intents.retrieve('pi_3QUbknF2v1Yns8Jb0n84xrPS')
# DEBU ConnectionManager starting request method_name=GET path="/v1/payment_intents/pi_3QUbknF2v1Yns8Jb0n84xrPS?" process_id=1 thread_object_id=8400 connection_manager_object_id=321040 connection_object_id=321060 log_timestamp=93423.4299955
# DEBU ConnectionManager request complete method_name=GET path="/v1/payment_intents/pi_3QUbknF2v1Yns8Jb0n84xrPS?" process_id=1 thread_object_id=8400 connection_manager_object_id=321040 connection_object_id=321060 response_object_id=321080 log_timestamp=93424.511355943

OS

macOS

Language version

Ruby 3.1.5

Library version

stripe-ruby v13.3.0

API version

2024-06-20

Additional context

I asked about this in the dev discord and the suggested I open an issue. Also just to clarify, the open_timeout is a contrived example to show it's not working. One of the more important ones we actually want to configure is Stripe.enable_telemetry = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant