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

Error when calling Stripe::APIResource#refresh #1506

Open
yukideluxe opened this issue Dec 17, 2024 · 5 comments
Open

Error when calling Stripe::APIResource#refresh #1506

yukideluxe opened this issue Dec 17, 2024 · 5 comments
Assignees
Labels

Comments

@yukideluxe
Copy link

yukideluxe commented Dec 17, 2024

Describe the bug

Hello!

We are experiencing the following error when calling the Stripe::APIResource#refresh method if the resource has been retrieved from a list API request I think this has been happening since v13.0.0 🙏🏻

NoMethodError: undefined method `execute_request_initialize_from' for nil

To Reproduce

  1. Fetch a list of Customers (or any other list like Subscriptions, Coupons, Products, etc)
  2. Call the #refresh method on one of the results of the list

Expected behavior

The Stripe::APIResource#refresh method successfully triggers a resource refresh

Code snippets

test-app(dev)> stripe_customers = Stripe::Customer.list
=>
#<Stripe::ListObject:0x4704> JSON: {
...
test-app(dev)> stripe_customer = stripe_customers.first
=>
#<Stripe::Customer:0x9d30 id=********> JSON: {
...
test-app(dev)> stripe_customer.refresh
/Users/julia/.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1260:in `full_message': undefined method `execute_request_initialize_from' for nil (NoMethodError)

      @obj = @requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

OS

macOS

Language version

Ruby 3.3.6

Library version

stripe-ruby v13.0.0

API version

2024-06-20

Additional context

We only use #refresh on our test code and this issue affects our ability to upgrade the gem without significant code changes in the test suite. I wanted to bring awareness in case this is considered a bug but if this is an expected behavior, we will tweak our code!

@yukideluxe yukideluxe added the bug label Dec 17, 2024
@nehresma
Copy link

@yukideluxe I just ran into this a few minutes ago as well while trying to upgrade our gem to the 13.x series. The most recent version that works for me with .refresh is 12.6.0.

I suspect the .refresh breakage is related to the StripeClient change stuff introduced in version 13: https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v13

@helenye-stripe
Copy link
Contributor

Hi y'all! Thanks for reporting. We'll investigate and have a fix up soon!

@helenye-stripe helenye-stripe self-assigned this Dec 17, 2024
@nehresma
Copy link

Thanks @helenye-stripe. To be clear -- I don't think this is an actual bug. We just need to adjust our code to use the new StripeClient call pattern that was introduced in v13 of the gem.

@helenye-stripe
Copy link
Contributor

From what I've looked at, I think this is a bug that would persist even in the StripeClient pattern. We also plan to continue to support the existing resource-based pattern functionality, so we would like to fix this even if it wasn't.

@nehresma
Copy link

Fair enough. Thank you!

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

3 participants