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 `first' for ActionDispatch::Response::RackBody #143

Open
tomca32 opened this issue Aug 19, 2019 · 6 comments
Open

undefined method `first' for ActionDispatch::Response::RackBody #143

tomca32 opened this issue Aug 19, 2019 · 6 comments

Comments

@tomca32
Copy link

tomca32 commented Aug 19, 2019

When starting the application, the first request that results in a redirect will produce this error.

Seems that the first request completes fine and gets a 302 response, but the error seems to happen on the response to the following request.

From the logs:

2019-08-18 21:16:57.504511 I [18265:puma 003] {request_id: c7cfb1ce-3fcc-4406-a1a8-95cc8b2809a6} (75.1ms) ChaptersController -- Completed #create -- { :controller => "ChaptersController", :action => "create", :format => "HTML", :method => "POST", :path => "/chapters", :status => 302

2019-08-18 21:16:57.521405 D [18265:puma 003] {request_id: 102a4b3e-54d4-44da-b467-c9b7a4f70298} Rack -- Started -- { :method => "GET", :path => "/chapters", :ip => "127.0.0.1" }

2019-08-18 21:16:57.851207 I [18265:puma 003] {request_id: 102a4b3e-54d4-44da-b467-c9b7a4f70298} (308.8ms) ChaptersController -- Completed #index -- { :controller => "ChaptersController", :action => "index", :format => "HTML", :method => "GET", :path => "/chapters", :status => 200, :view_runtime => 264.01, :sk_rendered_format => :html, :sk_variant => [], :db_runtime => 20.98, :status_message => "OK" }

2019-08-18 21:16:57.880673 F [18265:puma 003 log_interceptor.rb:26] {request_id: 102a4b3e-54d4-44da-b467-c9b7a4f70298} Rails --
NoMethodError - undefined method `first' for #<ActionDispatch::Response::RackBody:0x00007fb2e93a7700>:

image

This doesn't seem to happen again on any following requests until the app has been restarted. Then it happens again on the first one.

@wagenet
Copy link
Contributor

wagenet commented Aug 19, 2019

@tomca32 thanks for reporting this, and sorry for the trouble! We haven't seen anything like this before. Would you be willing to share your Gemfile with us? (If not publicly, maybe via our in-app messenger?) Also, is it possible for you to add a rescue in this method and tell us what arguments the method is being called with when it fails?

@tomca32
Copy link
Author

tomca32 commented Aug 19, 2019

Sure thing, thanks for checking this out. Here's the Gemfile. I'd love to add a rescue as well and check the args, but that link 404s for me.

# frozen_string_literal: true

source 'https://rubygems.org'

gem 'rails'
# Use postgres as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

gem 'devise'
gem 'omniauth-google-oauth2'
gem 'pundit'
gem 'rolify'
gem 'tiddle'

gem 'awesome_print'
gem 'rails_semantic_logger'

gem 'active_model_serializers', '~> 0.10.10'
gem 'bootsnap'
gem 'carrierwave'
gem 'carrierwave-bombshelter'
gem 'carrierwave-imageoptimizer'
gem 'cocoon'
gem 'enum_help'
gem 'fog-aws'
gem 'has_scope'
gem 'inline_svg'
gem 'marginalia'
gem 'mini_magick'
gem 'pagy'
gem 'pg_query', '>= 0.9.0'
gem 'pg_search'
gem 'pghero'
gem 'puma'
gem 'scenic'
gem 'simple_form'
gem 'skylight'
gem 'slim'
gem 'turbolinks'

gem 'mindleaps_analytics', path: ENV['MINDLEAPS_ANALYTICS_PATH'] if ENV['MINDLEAPS_ANALYTICS_PATH']

group :production do
  gem 'newrelic_rpm'
  gem 'SyslogLogger'
end

group :development, :test do
  gem 'apparition'
  gem 'bullet', '!= 6.0.0' # 6.0.0 seems to break with Turbolinks
  gem 'debase'
  gem 'rails-controller-testing'
  gem 'rubocop'
  gem 'rubocop-performance'
  gem 'rubocop-rails'
  gem 'ruby-debug-ide'
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Rspec requires capybara > 2.1
  gem 'capybara', '> 2.1'
  gem 'coveralls', require: false
  gem 'database_cleaner'
  gem 'factory_bot_rails'
  gem 'faker'
  gem 'json_matchers'
  gem 'meta_request'
  gem 'pundit-matchers'
  gem 'rspec-rails'
  gem 'selenium-webdriver'
  gem 'shoulda-matchers'
  gem 'smarter_csv'
  gem 'webdrivers'
  gem 'webmock'
end

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'dotenv-rails'
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'pry'
  gem 'spring'
end

@zvkemp
Copy link
Contributor

zvkemp commented Aug 19, 2019

@tomca32
Copy link
Author

tomca32 commented Aug 19, 2019

Thanks. Seems that args are [:first], and block is nil.

image

@tomca32
Copy link
Author

tomca32 commented Aug 19, 2019

Oh...seems this is coming from Bullet and is probably not Skylight's problem

image

@wagenet
Copy link
Contributor

wagenet commented Aug 19, 2019

@tomca32 well I think maybe we should respond to body. I'll work it out with the team.

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

3 participants