#3746 - blocks#create (NoMethodError) "undefined method `firebase_token' for nil:NilClass"

A NoMethodError occurred in blocks#create:

 undefined method `firebase_token' for nil:NilClass
 app/lib/firebase/notification.rb:29:in `block in initialize'


-------------------------------
Request:
-------------------------------

 * URL        : https://www.bikelink.org/cards/5512/block
 * HTTP Method: POST
 * IP address : 71.198.186.209
 * Parameters : {"authenticity_token"=>"[FILTERED]", "card_block_record"=>{"reason"=>"blocked card issue"}, "commit"=>"Block the card", "controller"=>"cards/blocks", "action"=>"create", "card_id"=>"5512"}
 * Timestamp  : 2024-06-19 00:33:14 UTC
 * Server : www-11.internal.bikelink.org
   * Rails root : /var/www/bikelink
 * Process: 197809

-------------------------------
Session:
-------------------------------

 * session id: [FILTERED]
 * data: {"session_id"=>"fc39876ac81f842210e0c0bf49ceda12",
  "warden.user.person.key"=>[[31069], "aS4D8gZPuz3F2YRuq8Wc"],
  "_csrf_token"=>"TsVrbFnETi0iBcvuUvOB4Y3XrGr8bsuiLANZCwvEt88="}

-------------------------------
Environment:
-------------------------------

 * CONTENT_LENGTH                                          : 186
   * CONTENT_TYPE                                            : application/x-www-form-urlencoded
   * GATEWAY_INTERFACE                                       : CGI/1.2
   * HTTP_ACCEPT                                             : text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
   * HTTP_ACCEPT_ENCODING                                    : gzip, deflate, br, zstd
   * HTTP_ACCEPT_LANGUAGE                                    : en-US,en;q=0.9
   * HTTP_CACHE_CONTROL                                      : max-age=0
   * HTTP_CONNECTION                                         : close
   * HTTP_COOKIE                                             : _ga=GA1.1.516535532.1688659432; __utmz=136922275.1712853927.6.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=136922275.39243615.1671038859.1713543594.1713892747.19; _ga_5XJXN3VELE=GS1.1.1715964642.22.1.1715964695.0.0.0; _bikelink_session=MeeXl0Af41exKO7a5v9TW34SxTFFMvhIGJU5C2L9t5HwbWamqH%2F4oNNWGzKQ5xcl7iRht%2Bh6u%2BkH87rIW6%2BnKgmhN0GVQ313pNYLpoBsyDh6O1aZVCWIUEywz72ypZ%2BZbMfUZQA4cMcVkel8D36N%2BzwqsVwZd9s5sPuUaNIjhBCpdctbb7E%2BVAY7MbQBSjh3tThN%2BwrvGeldHnR1RUwMDZZONBAcSeqqMADuCNS%2B7MJJ9XVzJD6PPPhS0BbWksuFiNdsnAjf1nTkUo7pc29QDy4luuCWzHGEdntmKj48Gnza92ut213j%2BtTfPJfebDxA1r4rpHFfBvBT4E5cXGlyY7qnQ4okL67c4xhSedKLbYiqon6gb0s21RvN1uFlQRGC2d7uHEw%3D--ryFG82a4XYlNV8UJ--MwOCBMmFQfM03kSGK6rXSg%3D%3D
   * HTTP_HOST                                               : www.bikelink.org
   * HTTP_ORIGIN                                             : https://www.bikelink.org
   * HTTP_PRIORITY                                           : u=0, i
   * HTTP_REFERER                                            : https://www.bikelink.org/cards/5512/block/new
   * HTTP_SEC_CH_UA                                          : "Not/A)Brand";v="8", "Chromium";v="126", "Microsoft Edge";v="126"
   * HTTP_SEC_CH_UA_MOBILE                                   : ?0
   * HTTP_SEC_CH_UA_PLATFORM                                 : "Windows"
   * HTTP_SEC_FETCH_DEST                                     : document
   * HTTP_SEC_FETCH_MODE                                     : navigate
   * HTTP_SEC_FETCH_SITE                                     : same-origin
   * HTTP_SEC_FETCH_USER                                     : ?1
   * HTTP_UPGRADE_INSECURE_REQUESTS                          : 1
   * HTTP_USER_AGENT                                         : Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
   * HTTP_VERSION                                            : HTTP/1.0
   * HTTP_X_AMZN_TRACE_ID                                    : Root=1-6672274a-66d8cc6962d2625721d9511f
   * HTTP_X_FORWARDED_FOR                                    : 71.198.186.209, 71.198.186.209
   * HTTP_X_FORWARDED_PORT                                   : 443
   * HTTP_X_FORWARDED_PROTO                                  : https
   * ORIGINAL_FULLPATH                                       : /cards/5512/block
   * ORIGINAL_SCRIPT_NAME                                    :
   * PATH_INFO                                               : /cards/5512/block
   * QUERY_STRING                                            :
   * REMOTE_ADDR                                             : 127.0.0.1
   * REQUEST_METHOD                                          : POST
   * REQUEST_PATH                                            : /cards/5512/block
   * REQUEST_URI                                             : /cards/5512/block
   * ROUTES_13640_SCRIPT_NAME                                :
   * SCRIPT_NAME                                             :
   * SERVER_NAME                                             : www.bikelink.org
   * SERVER_PORT                                             : 443
   * SERVER_PROTOCOL                                         : HTTP/1.0
   * SERVER_SOFTWARE                                         : puma 6.4.0 The Eagle of Durango
   * action_controller.instance                              : #<Cards::BlocksController:0x00007f96ca116940>
   * action_dispatch.authenticated_encrypted_cookie_salt     : [FILTERED]
   * action_dispatch.backtrace_cleaner                       : #<Rails::BacktraceCleaner:0x00005e50b5df3b30>
   * action_dispatch.content_security_policy                 :
   * action_dispatch.content_security_policy_nonce_directives:
   * action_dispatch.content_security_policy_nonce_generator :
   * action_dispatch.content_security_policy_report_only     : false
   * action_dispatch.cookies                                 : #<ActionDispatch::Cookies::CookieJar:0x00007f96ca107e40>
   * action_dispatch.cookies_digest                          :
   * action_dispatch.cookies_rotations                       : #<ActiveSupport::Messages::RotationConfiguration:0x00005e50b33b8708>
   * action_dispatch.cookies_same_site_protection            : #<Proc:0x00005e50b96dccf8 /var/www/bikelink/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:636>
   * action_dispatch.cookies_serializer                      : json
   * action_dispatch.encrypted_cookie_cipher                 : [FILTERED]
   * action_dispatch.encrypted_cookie_salt                   : [FILTERED]
   * action_dispatch.encrypted_signed_cookie_salt            : [FILTERED]
   * action_dispatch.http_auth_salt                          : [FILTERED]
   * action_dispatch.key_generator                           : #<ActiveSupport::CachingKeyGenerator:0x00005e50bbfa8768>
   * action_dispatch.logger                                  : #<ActiveSupport::Logger:0x00005e50b48c8d50>
   * action_dispatch.parameter_filter                        : [:confirm_password, :credit_card_number, :password, :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn]
   * action_dispatch.permissions_policy                      :
   * action_dispatch.redirect_filter                         : []
   * action_dispatch.remote_ip                               : 71.198.186.209
   * action_dispatch.request.content_type                    : application/x-www-form-urlencoded
   * action_dispatch.request.formats                         : [#<Mime::Type:0x00005e50b2c01a28 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html", @hash=-3303615028687621313>]
   * action_dispatch.request.parameters                      : {"authenticity_token"=>"[FILTERED]", "card_block_record"=>{"reason"=>"blocked card issue"}, "commit"=>"Block the card", "controller"=>"cards/blocks", "action"=>"create", "card_id"=>"5512"}
   * action_dispatch.request.path_parameters                 : {:controller=>"cards/blocks", :action=>"create", :card_id=>"5512"}
   * action_dispatch.request.query_parameters                : {}
   * action_dispatch.request.request_parameters              : {"authenticity_token"=>"[FILTERED]", "card_block_record"=>{"reason"=>"blocked card issue"}, "commit"=>"Block the card"}
   * action_dispatch.request.unsigned_session_cookie         : {"session_id"=>"fc39876ac81f842210e0c0bf49ceda12", "warden.user.person.key"=>[[31069], "aS4D8gZPuz3F2YRuq8Wc"], "_csrf_token"=>"[FILTERED]"}
   * action_dispatch.request_id                              : 0343fe19-10fd-4094-a600-f9ad2d969ae2
   * action_dispatch.routes                                  : #<ActionDispatch::Routing::RouteSet:0x00005e50b7ad1360>
   * action_dispatch.secret_key_base                         : [FILTERED]
   * action_dispatch.show_detailed_exceptions                : false
   * action_dispatch.show_exceptions                         : true
   * action_dispatch.signed_cookie_digest                    :
   * action_dispatch.signed_cookie_salt                      : [FILTERED]
   * action_dispatch.use_authenticated_cookie_encryption     : [FILTERED]
   * action_dispatch.use_cookies_with_metadata               : true
   * newrelic.transaction_started                            : true
   * puma.config                                             : #<Puma::Configuration:0x00005e50b23e9e58>
   * puma.request_body_wait                                  : 0.014198780059814453
   * puma.socket                                             : #<UNIXSocket:0x00007f96ca13f9a8>
   * rack.after_reply                                        : []
   * rack.errors                                             : #<IO:0x00005e50b1859818>
   * rack.hijack                                             : #<Puma::Client:0x00007f96ca13f980>
   * rack.hijack?                                            : true
   * rack.input                                              : #<StringIO:0x00007f96ca13f110>
   * rack.multiprocess                                       : true
   * rack.multithread                                        : true
   * rack.request.cookie_hash                                : {"_ga"=>"GA1.1.516535532.1688659432", "__utmz"=>"136922275.1712853927.6.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)", "__utma"=>"136922275.39243615.1671038859.1713543594.1713892747.19", "_ga_5XJXN3VELE"=>"GS1.1.1715964642.22.1.1715964695.0.0.0", "_bikelink_session"=>"MeeXl0Af41exKO7a5v9TW34SxTFF...
   * rack.request.cookie_string                              : _ga=GA1.1.516535532.1688659432; __utmz=136922275.1712853927.6.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=136922275.39243615.1671038859.1713543594.1713892747.19; _ga_5XJXN3VELE=GS1.1.1715964642.22.1.1715964695.0.0.0; _bikelink_session=MeeXl0Af41exKO7a5v9TW34SxTFFMvhIGJU5C2L9t5HwbWamqH%2F4oNNWGzKQ5xcl7iRht%2Bh6u%2BkH87rIW6%2BnKgmhN0GVQ313pNYLpoBsyDh6O1aZVCWIUEywz72ypZ%2BZbMfUZQA4cMcVkel8D36N%2BzwqsVwZd9s5sPuUaNIjhBCpdctbb7E%2BVAY7MbQBSjh3tThN%2BwrvGeldHnR1RUwMDZZONBAcSeqqMADuCNS%2B7MJJ9XVzJD6PPPhS0BbWksuFiNdsnAjf1nTkUo7pc29QDy4luuCWzHGEdntmKj48Gnza92ut213j%2BtTfPJfebDxA1r4rpHFfBvBT4E5cXGlyY7qnQ4okL67c4xhSedKLbYiqon6gb0s21RvN1uFlQRGC2d7uHEw%3D--ryFG82a4XYlNV8UJ--MwOCBMmFQfM03kSGK6rXSg%3D%3D
   * rack.request.form_hash                                  : {"authenticity_token"=>"[FILTERED]", "card_block_record"=>{"reason"=>"blocked card issue"}, "commit"=>"Block the card"}
   * rack.request.form_input                                 : #<StringIO:0x00007f96ca13f110>
   * rack.request.form_vars                                  : [FILTERED]
   * rack.request.query_hash                                 : {}
   * rack.request.query_string                               :
   * rack.run_once                                           : false
   * rack.session                                            : #<ActionDispatch::Request::Session:0x00007f96ca11f388>
   * rack.session.options                                    : #<ActionDispatch::Request::Session::Options:0x00007f96ca11f338>
   * rack.tempfiles                                          : []
   * rack.url_scheme                                         : https
   * rack.version                                            : [1, 6]
   * warden                                                  : Warden::Proxy:8072180 @config={:default_scope=>:person, :scope_defaults=>{}, :default_strategies=>{:person=>[:two_factor_authenticatable, :two_factor_authenticatable, :rememberable]}, :intercept_401=>false, :failure_app=>#<Devise::Delegator:0x00005e50b58d6da0>}

-------------------------------
Backtrace:
-------------------------------

 app/lib/firebase/notification.rb:29:in `block in initialize'
 app/lib/firebase/notification.rb:29:in `filter'
 app/lib/firebase/notification.rb:29:in `initialize'
 app/models/card_block_record.rb:22:in `new'
 app/models/card_block_record.rb:22:in `send_card_block_updated'
 app/controllers/cards/blocks_controller.rb:19:in `create'
 app/controllers/application_controller.rb:45:in `process_action'
Reload