MiniProfiler / rack-mini-profiler

Profiler for your development and production Ruby rack apps.
MIT License
3.7k stars 402 forks source link

@config in client_settings.rb is nil #477

Closed jules2689 closed 3 years ago

jules2689 commented 3 years ago

https://github.com/MiniProfiler/rack-mini-profiler/blob/93e0b5e25f5cd58a3acb92cae016a5cca98ee265/lib/mini_profiler/client_settings.rb#L97-L99

This block of code was run for me, but threw an error because @config was nil. This caused a total application failure as the app could no longer boot.

#<NoMethodError: undefined method `storage_failure' for nil:NilClass>
/app/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.4/lib/mini_profiler/client_settings.rb:96:in `rescue in has_valid_cookie?'
/app/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.4/lib/mini_profiler/client_settings.rb:93:in `has_valid_cookie?'
/app/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.4/lib/mini_profiler/profiler.rb:198:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/railties-6.1.0/lib/rails/engine.rb:539:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/configuration.rb:228:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:713:in `handle_request'
/app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:472:in `process_client'
/app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/server.rb:328:in `block in run'
/app/vendor/bundle/ruby/2.6.0/gems/puma-4.3.5/lib/puma/thread_pool.rb:134:in `block in spawn_thread'

I think @config should be Rack::MiniProfiler.config, but I am not sure! This was introduced here: https://github.com/MiniProfiler/rack-mini-profiler/commit/930eccd99d5e4acf8ff43558b06a9a4ed134d5f8

(For context: The rescue was hit changing from RedisStore to FileStore, uncertain why though.)

SamSaffron commented 3 years ago

Thanks heaps, yeah ... that look like it!