user8737928
user8737928

Reputation: 51

Rails - actual error not shown - showing rack/etag error with headers array

When my Rails application encounters any error, instead of reporting the error I am getting the same error "undefined method [] for nil:NilClass" no matter what the underlying error is that is triggered. This happens regardless of wether I enable the better_errors gem or not.

I thought this was because of an upgrade to Puma 4.3.5 but the error persists after downgrading to 4.3.3 again.

The headers array is nil causing headers[CACHE_CONTROL] to fail in line 38.

callrack (2.2.3) lib/rack/etag.rb

33      original_body.close if original_body.respond_to?(:close)
34    end
35    headers[ETAG_STRING] = %(W/"#{digest}") if digest
36  end
37
38  unless headers[CACHE_CONTROL]
39    if digest
40      headers[CACHE_CONTROL] = @cache_control if @cache_control
41    else
42      headers[CACHE_CONTROL] = @no_cache_control if @no_cache_control
43    end

I am using the following gem list:

actioncable (5.2.4.3, 5.2.3)
actionmailer (5.2.4.3, 5.2.3)
actionpack (5.2.4.3, 5.2.3)
actionview (5.2.4.3, 5.2.3)
active_model_serializers (0.10.10)
activejob (5.2.4.3, 5.2.3)
activemodel (5.2.4.3, 5.2.3)
activerecord (5.2.4.3, 5.2.3)
activestorage (5.2.4.3, 5.2.3)
activesupport (5.2.4.3, 5.2.3)
addressable (2.7.0)
akami (1.3.1)
animate-rails (1.0.10)
arel (9.0.0)
ast (2.4.1, 2.4.0)
attr_encrypted (3.1.0)
autoprefixer-rails (9.8.5, 9.7.4)
backports (3.16.1)
bcrypt (3.1.13)
better_errors (2.7.1, 2.5.1)
bigdecimal (default: 1.3.4)
binding_of_caller (0.8.0)
bootsnap (1.4.6, 1.4.5)
bootstrap-datepicker-rails (1.9.0.1)
bootstrap-sass (3.4.1)
bootstrap-select-rails (1.13.8)
bootstrap-tooltip-rails (0.1)
bootstrap_form (2.7.0)
bson (4.9.4, 4.7.1)
bson_ext (1.5.1)
builder (3.2.4)
bundler (default: 1.17.3)
bundler-unload (1.0.2)
cancancan (3.1.0, 3.0.2)
capybara (3.33.0, 3.31.0)
carrierwave (2.1.0)
carrierwave-base64 (2.8.1, 2.8.0)
carrierwave-i18n (0.2.0)
carrierwave-mongoid (1.3.0)
case_transform (0.2)
chunky_png (1.3.11)
cmath (default: 1.0.0)
coderay (1.1.3, 1.1.2)
coffee-rails (5.0.0)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.1.6)
connection_pool (2.2.3, 2.2.2)
crass (1.0.6) 
csv (default: 1.0.0) 
cuba (3.9.2)
cucumber (4.1.0, 3.1.2) 
cucumber-core (7.1.0, 3.2.1) 
cucumber-create-meta (1.0.0) 
cucumber-cucumber-expressions (10.2.1) 
cucumber-expressions (6.0.1) 
cucumber-gherkin (14.0.1)
cucumber-html-formatter (7.0.0) 
cucumber-messages (12.2.0)
cucumber-rails (2.1.0, 2.0.0) 
cucumber-tag-expressions (2.0.4)
cucumber-tag_expressions (1.1.1) 
cucumber-wire (3.1.0, 0.0.1) 
daemons (1.3.1) 
database_cleaner (1.8.5, 1.8.3) 
date (default: 1.0.0) 
dbm (default: 1.0.0) 
debug_inspector (0.0.3) 
devise (4.7.2, 4.7.1)
devise-bootstrap-views (1.1.0) 
devise-i18n (1.9.1, 1.9.0)
devise-two-factor (3.1.0) 
did_you_mean (1.2.0) 
diff-lcs (1.3)
domain_name (0.5.20190701) 
doorkeeper (4.4.3) 
doorkeeper-mongodb (4.2.0) 
down (5.1.1) 
encryptor (3.0.0) 
erubi (1.9.0) 
et-orbi (1.2.4, 1.2.2) 
etc (default: 1.0.0) 
execjs (2.7.0) 
executable-hooks (1.6.0) 
exonio (0.5.4, 0.5.3) 
factory_bot (6.1.0, 5.1.1) 
factory_bot_rails (6.1.0, 5.1.1) 
faker (2.13.0, 2.10.2) 
fcntl (default: 1.0.0) 
ffi (1.13.1, 1.12.2) 
fiddle (default: 1.0.0) 
fileutils (default: 1.0.2)
flamegraph (0.9.5) 
font-awesome-sass (5.13.0, 5.12.0) 
fugit (1.3.6, 1.3.3) 
gdbm (default: 2.0.0) 
gem-wrappers (1.4.0) 
geocoder (1.6.3, 1.6.1) 
gherkin (5.1.0) 
globalid (0.4.2) 
google_custom_search_api (2.0.0) 
gyoku (1.3.1) 
http-accept (1.7.0) 
http-cookie (1.0.3)
httparty (0.18.1, 0.18.0) 
httpi (2.4.5, 2.4.4) 
i18n (1.8.3, 1.8.2)
image_processing (1.11.0, 1.10.3) 
interactor (3.1.2) 
io-console (default: 0.4.6) 
ipaddr (default: 1.2.0) 
iye (1.1.1) 
jaro_winkler (1.5.4) 
jasny-bootstrap-rails (3.1.3) 
jbuilder (2.10.0)
jquery-easing-rails (0.0.2) 
jquery-rails (4.4.0, 4.3.5)
jquery-tablesorter (1.27.2, 1.27.1) 
jquery-ui-rails (6.0.1) 
json (2.3.1, 2.3.0, default: 2.1.0) 
jsonapi-renderer (0.2.2) 
jwt (2.2.1)
launchy (2.5.0, 2.4.3) 
letter_opener (1.7.0) 
listen (3.2.1)
localized_fields (0.1.0) 
loofah (2.6.0, 2.4.0) 
mail (2.7.1) 
marcel (0.3.3) 
material_icons (2.2.1) 
materialize-form (1.0.8)
materialize-sass (0.99.0) 
memory_profiler (0.9.14) 
method_source (1.0.0, 0.9.2) 
middleware (0.1.0) 
mime-types (3.3.1) 
mime-types-data (3.2020.0512, 3.2019.1009) 
mimemagic (0.3.5, 0.3.4) 
mini_magick (4.10.1) 
mini_mime (1.0.2) 
mini_portile2 (2.4.0) 
minitest (5.14.1, 5.14.0, 5.10.3) 
mollie-api-ruby (4.7.1) 
momentjs-rails (2.20.1) 
mongo (2.12.1, 2.11.3) 
mongo_session_store (3.2.1, 3.2.0) 
mongoid (6.4.4)
mongoid-compatibility (0.5.1) 
mongoid-grid_fs (2.4.0)
mongoid-rspec (4.1.0, 4.0.1) 
msgpack (1.3.3) 
multi_json (1.14.1) 
multi_test (0.1.2)
multi_xml (0.6.0) 
nested_form (0.3.2) 
net-telnet (0.1.1) 
netrc (0.11.0) 
nio4r (2.5.2) 
nokogiri (1.10.10, 1.10.8) 
nori (2.6.0)
okcomputer (1.18.2, 1.18.1)
openssl (default: 2.1.2) 
orm_adapter (0.5.0) 
parallel (1.19.2, 1.19.1) 
parser (2.7.1.4, 2.7.0.2)
pdfjs_viewer-rails (0.3.1) 
pdfkit (0.8.4.3.1, 0.8.4.1) 
popper_js (1.16.0) 
power_assert (1.1.1) 
protobuf-cucumber (3.10.8) 
pry (0.13.1, 0.12.2) 
pry-rails (0.3.9) 
psych (3.1.0, default: 3.0.2) 
public_suffix (4.0.5, 4.0.3) 
puma (4.3.5, 4.3.3) 
raabro (1.3.1, 1.1.6) 
rack (2.2.3, 2.2.2) 
rack-mini-profiler (2.0.2, 1.1.6) 
rack-protection (2.0.8.1) 
rack-test (1.1.0) rails (5.2.4.3, 5.2.3) 
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0) 
rails-i18n (5.1.3) 
rails-static-router (1.0.3) 
rails_12factor (0.0.3) 
rails_bootstrap_sortable (2.0.7)
rails_serve_static_assets (0.0.5) 
rails_stdout_logging (0.0.5)
railties (5.2.4.3, 5.2.3) 
rainbow (3.0.0) 
rake (13.0.1, 12.3.3)
rb-fsevent (0.10.4, 0.10.3) 
rb-inotify (0.10.1)
rdoc (default: 6.0.1.1) 
redis (4.2.1, 4.1.3) 
regexp_parser (1.7.1, 1.7.0) 
responders (3.0.1, 3.0.0) 
rest-client (2.1.0) 
rexml (3.2.4) 
rotp (2.1.2) 
rqrcode (1.1.2) 
rqrcode_core (0.1.2, 0.1.1) 
rspec (3.9.0) 
rspec-core (3.9.2, 3.9.1) 
rspec-expectations (3.9.2, 3.9.0) 
rspec-mocks (3.9.1) 
rspec-rails (3.9.1, 3.9.0) 
rspec-support (3.9.3, 3.9.2) 
rubocop (0.88.0, 0.80.0) 
rubocop-ast (0.1.0) 
ruby-prof (1.4.1, 1.3.0)
ruby-progressbar (1.10.1) 
ruby-vips (2.0.17) 
rubygems-bundler (1.4.5)
rufus-scheduler (3.6.0) 
rvm (1.11.3.9) 
sass (3.7.4) 
sass-listen (4.0.0) 
sass-rails (5.1.0) 
sassc (2.4.0, 2.2.1) 
sassc-rails (2.1.2)
savon (2.12.1, 2.12.0) 
scanf (default: 1.0.0) 
sdbm (default: 1.0.0)
sidekiq (5.2.2) 
simple-form-datepicker (0.1.3) 
simple_calendar (2.4.1, 2.3.0) 
simple_form (5.0.2) 
smarter_csv (1.2.6) 
socksify (1.7.1) 
spring (2.1.0)
sprockets (3.7.2) 
sprockets-rails (3.2.1)
stackprof (0.2.15) 
stringio (default: 0.0.1) 
strscan (default: 1.0.0)
summernote-rails (0.8.12.0) 
sys-uname (1.2.1) 
test-unit (3.2.7) 
thor (1.0.1) 
thread_safe (0.3.6) 
tilt (2.0.10) 
time_difference (0.7.0)
tzinfo (1.2.7, 1.2.6) 
uglifier (4.2.0) 
unf (0.1.4) 
unf_ext (0.0.7.7, 0.0.7.6) 
unicode-display_width (1.7.0, 1.6.1) 
warden (1.2.8) 
wasabi (3.5.0) 
webrick (default: 1.4.2) 
websocket-driver (0.7.3, 0.7.1)
websocket-extensions (0.1.5, 0.1.4) 
wicked (1.3.4)
wkhtmltopdf-binary-edge (0.12.5.1) 
wkhtmltopdf-heroku (2.12.5.0)
xmlrpc (0.3.0)
xpath (3.2.0) 
zlib (default: 1.0.0)

These are the gem changes that were done with the latest update:

Installing i18n 1.8.3 (was 1.8.2)
Installing minitest 5.14.1 (was 5.14.0)
Installing tzinfo 1.2.7 (was 1.2.6)
Installing nokogiri 1.10.10 (was 1.10.8) with native extensions
Installing loofah 2.6.0 (was 2.4.0)
Installing rack 2.2.3 (was 2.2.2)
Installing websocket-extensions 0.1.5 (was 0.1.4)
Installing websocket-driver 0.7.3 (was 0.7.1) with native extensions
Installing mimemagic 0.3.5 (was 0.3.4)
Installing public_suffix 4.0.5 (was 4.0.3)
Installing method_source 1.0.0 (was 0.9.2)
Installing ast 2.4.1 (was 2.4.0)
Installing autoprefixer-rails 9.8.5 (was 9.7.4)
Installing coderay 1.1.3 (was 1.1.2)
Installing better_errors 2.7.1 (was 2.5.1)
Installing bootsnap 1.4.6 (was 1.4.5) with native extensions
Installing ffi 1.13.1 (was 1.12.2) with native extensions
Installing sassc 2.4.0 (was 2.2.1) with native extensions
Installing bson 4.9.4 (was 4.7.1) with native extensions
Installing cancancan 3.1.0 (was 3.0.2)
Installing regexp_parser 1.7.1 (was 1.7.0)
Installing capybara 3.33.0 (was 3.31.0)
Installing image_processing 1.11.0 (was 1.10.3)
Installing mime-types-data 3.2020.0512 (was 3.2019.1009)
Installing carrierwave-base64 2.8.1 (was 2.8.0)
Installing mongo 2.12.1 (was 2.11.3)
Installing connection_pool 2.2.3 (was 2.2.2)
Installing cucumber-core 7.1.0 (was 3.2.1)
Installing cucumber-wire 3.1.0 (was 0.0.1)
Installing cucumber 4.1.0 (was 3.1.2)
Installing cucumber-rails 2.1.0 (was 2.0.0)
Installing database_cleaner 1.8.5 (was 1.8.3)
Installing responders 3.0.1 (was 3.0.0)
Installing devise 4.7.2 (was 4.7.1)
Installing devise-i18n 1.9.1 (was 1.9.0)
Installing unf_ext 0.0.7.7 (was 0.0.7.6) with native extensions
Installing et-orbi 1.2.4 (was 1.2.2)
Installing exonio 0.5.4 (was 0.5.3)
Installing factory_bot 6.1.0 (was 5.1.1)
Installing factory_bot_rails 6.1.0 (was 5.1.1)
Installing faker 2.13.0 (was 2.10.2)
Installing font-awesome-sass 5.13.0 (was 5.12.0)
Installing raabro 1.3.1 (was 1.1.6)
Installing fugit 1.3.6 (was 1.3.3)
Installing geocoder 1.6.3 (was 1.6.1)
Installing httparty 0.18.1 (was 0.18.0)
Installing httpi 2.4.5 (was 2.4.4)
Installing jquery-rails 4.4.0 (was 4.3.5)
Installing jquery-tablesorter 1.27.2 (was 1.27.1)
Installing json 2.3.1 (was 2.3.0) with native extensions
Installing launchy 2.5.0 (was 2.4.3)
Installing rb-fsevent 0.10.4 (was 0.10.3)
Installing mongo_session_store 3.2.1 (was 3.2.0)
Installing rspec-support 3.9.3 (was 3.9.2)
Installing rspec-core 3.9.2 (was 3.9.1)
Installing rspec-expectations 3.9.2 (was 3.9.0)
Installing mongoid-rspec 4.1.0 (was 4.0.1)
Installing okcomputer 1.18.2 (was 1.18.1)
Installing parallel 1.19.2 (was 1.19.1)
Installing parser 2.7.1.4 (was 2.7.0.2)
Installing pdfkit 0.8.4.3.1 (was 0.8.4.1)
Installing pry 0.13.1 (was 0.12.2)
Installing puma 4.3.5 (was 4.3.3) with native extensions
Installing rack-mini-profiler 2.0.2 (was 1.1.6)
Installing redis 4.2.1 (was 4.1.3)
Installing rqrcode_core 0.1.2 (was 0.1.1)
Installing rspec-rails 3.9.1 (was 3.9.0)
Installing unicode-display_width 1.7.0 (was 1.6.1)
Installing rubocop 0.88.0 (was 0.80.0)
Installing ruby-prof 1.4.1 (was 1.3.0) with native extensions
Installing savon 2.12.1 (was 2.12.0)
Installing simple_calendar 2.4.1 (was 2.3.0)

I manualy downgraded the gems that i thought would have had an impact but there is no difference.

gem 'rails', '5.2.3'
gem 'puma', '4.3.3'
gem 'rack', '2.2.2'
gem 'websocket-extensions', '0.1.4'
gem 'websocket-driver', '0.7.1' 
gem 'connection_pool', '2.2.2'
gem 'httparty', '0.18.0'
gem 'better_errors', '2.5.1'
gem 'rack-mini-profiler', '1.1.6'

Upvotes: 2

Views: 485

Answers (1)

thomasdarde
thomasdarde

Reputation: 21

I finally found the error on my side, it's related to the pdfkit gem:

https://github.com/rack/rack/issues/1698

You need to lock pdfkit to 0.8.4.2 for the moment

Upvotes: 2

Related Questions