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

undefined method `[]' for an instance of ActionDispatch::Request #230

Closed
enstyled opened this issue Jun 14, 2024 · 4 comments · Fixed by #232
Closed

undefined method `[]' for an instance of ActionDispatch::Request #230

enstyled opened this issue Jun 14, 2024 · 4 comments · Fixed by #232

Comments

@enstyled
Copy link

Started getting this error after updating to Rails 7.1.3.4. It was bundled with other bundle update changes so it might also be another dependency.

undefined method `[]' for an instance of ActionDispatch::Request

From AppSignal:

Backtrace: stripe-rails (2.5.0) app/models/stripe/event_dispatch.rb:11:in `retrieve_stripe_event'

Once reverted to a version before the bundle update and retried the webhook, it all worked as before.

@enstyled
Copy link
Author

After further investigation, found out it's not the Rails version update that caused this, but the update of Rack from 3.0 to 3.1

@tansengming
Copy link
Owner

@enstyled thanks for creating the issue. I'm on holiday right now and will have look at it when I get back next week.

@4nd2in
Copy link
Contributor

4nd2in commented Jul 4, 2024

I am having the same error message (also rack 3.1) in the Stripe::EventDispatch::retrieve_stripe_event method. The problematic code is the line id = request['id'].

Property access syntax for parameters is not possible for ActionDispatch::Request anymore in rack version 3.1:

Request#[] is deprecated and will be removed in a future version of Rack. Please use request.params[] instead

For testing purposes I changed the code to request.params[:id] locally and I could retrieve the id I needed to do Stripe::Event.retrieve(id).

As for now, I need to use version 3.0 of rack until a fix for newer rack versions is released.

@enstyled
Copy link
Author

@tansengming Thank you for resolving this. I can confirm it all works with the latest version 👌🏼

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.

3 participants