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

Passing a frozen hash as opts raise FrozenError: can't modify frozen Hash #984

Closed
louim opened this issue Jun 28, 2021 · 4 comments · Fixed by #985
Closed

Passing a frozen hash as opts raise FrozenError: can't modify frozen Hash #984

louim opened this issue Jun 28, 2021 · 4 comments · Fixed by #985

Comments

@louim
Copy link

louim commented Jun 28, 2021

Passing a frozen hash to opts raises FrozenError: can't modify frozen Hash when calling Stripe::Customer.list.

STRIPE_CONFIG = {
  api_key: ENV["STRIPE_SECRET_KEY"],
  stripe_version: "2019-08-14"
}.freeze

Stripe::Customer.list({}, STRIPE_CONFIG)
FrozenError: can't modify frozen Hash
/Users/louim/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/stripe-5.34.0/lib/stripe/api_operations/request.rb:17:in `execute_resource_request'
/Users/louim/.asdf/installs/ruby/2.6.6/lib/ruby/gems/2.6.0/gems/stripe-5.34.0/lib/stripe/api_operations/list.rb:9:in `list'

However:

Stripe::Customer.retrieve("cus_abc123", STRIPE_CONFIG)

Works as expected.

I have not tested all types of operations, maybe there are others that have the same problem.

Using:

  • ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
  • Stripe ruby 5.34.0
@dcr-stripe
Copy link
Contributor

Hi @louim.

Thanks for the report! This is happening due to the opts modification on https://github.com/stripe/stripe-ruby/blob/19da5510/lib/stripe/api_operations/request.rb#L39.

Most calls use this method internally to make requests, so I think other types of operations have the same issue here.

Looking into potential holistic fixes to make sure we handle this.

@dcr-stripe
Copy link
Contributor

#985 should fix this - please re-open if you're still experiencing issues. Thanks!

@louim
Copy link
Author

louim commented Jun 29, 2021

Thanks for the quick fix, @dcr-stripe! Do you have a release policy for the gem? I'm wondering when a new version including this fix would be released.

@dcr-stripe
Copy link
Contributor

Hi @louim - we've just released a new version (https://github.com/stripe/stripe-ruby/releases/tag/v5.35.0) which should include the patch. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants