前提
rialsでユーザー認証(devise, devise_token_auth)のapi疎通を確認するためにcurlコマンドを使用して確認していたのですがapiと関係ない部分でエラーが発生しており、エラーメッセージを検索して調べてみていますが、解決できないため質問させていただきます。
実現したいこと
エラーの解決
発生している問題・エラーメッセージ
エラーメッセージを読むとkがnilのことがあるために発生している問題かと思うのですが、このkが何を表しているか、どこで使用されているか見つけられずに詰まっています。
NoMethodError (undefined method `downcase' for nil:NilClass canonical = k.downcase.freeze ^^^^^^^^^): rack (2.2.4) lib/rack/utils.rb:464:in `[]=' rack (2.2.4) lib/rack/utils.rb:432:in `block in initialize' rack (2.2.4) lib/rack/utils.rb:432:in `each' rack (2.2.4) lib/rack/utils.rb:432:in `initialize' rack (2.2.4) lib/rack/utils.rb:425:in `new' rack (2.2.4) lib/rack/utils.rb:425:in `[]' rack (2.2.4) lib/rack/etag.rb:29:in `call' rack (2.2.4) lib/rack/conditional_get.rb:40:in `call' rack (2.2.4) lib/rack/head.rb:12:in `call' activerecord (7.0.3.1) lib/active_record/migration.rb:603:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call' activesupport (7.0.3.1) lib/active_support/callbacks.rb:99:in `run_callbacks' actionpack (7.0.3.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/debug_exceptions.rb:28:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/show_exceptions.rb:26:in `call' railties (7.0.3.1) lib/rails/rack/logger.rb:40:in `call_app' railties (7.0.3.1) lib/rails/rack/logger.rb:25:in `block in call' activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:114:in `block in tagged' activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:38:in `tagged' activesupport (7.0.3.1) lib/active_support/tagged_logging.rb:114:in `tagged' railties (7.0.3.1) lib/rails/rack/logger.rb:25:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/remote_ip.rb:93:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/request_id.rb:26:in `call' rack (2.2.4) lib/rack/runtime.rb:22:in `call' activesupport (7.0.3.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/server_timing.rb:20:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/executor.rb:14:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/static.rb:23:in `call' rack (2.2.4) lib/rack/sendfile.rb:110:in `call' actionpack (7.0.3.1) lib/action_dispatch/middleware/host_authorization.rb:137:in `call' rack-cors (1.1.1) lib/rack/cors.rb:100:in `call' railties (7.0.3.1) lib/rails/engine.rb:530:in `call' puma (5.6.4) lib/puma/configuration.rb:252:in `call' puma (5.6.4) lib/puma/request.rb:77:in `block in handle_request' puma (5.6.4) lib/puma/thread_pool.rb:340:in `with_force_shutdown' puma (5.6.4) lib/puma/request.rb:76:in `handle_request' puma (5.6.4) lib/puma/server.rb:441:in `process_client' puma (5.6.4) lib/puma/thread_pool.rb:147:in `block in spawn_thread'
該当のソースコード
// gemfile source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby "3.1.2" # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 7.0.3", ">= 7.0.3.1" # Use postgresql as the database for Active Record gem "pg", "~> 1.1" # Use the Puma web server [https://github.com/puma/puma] gem "puma", "~> 5.0" # Build JSON APIs with ease [https://github.com/rails/jbuilder] # gem "jbuilder" # Use Redis adapter to run Action Cable in production # gem "redis", "~> 4.0" # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] # gem "kredis" # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] # gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] # Reduces boot times through caching; required in config/boot.rb gem "bootsnap", require: false # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible gem "rack-cors" # 認証用 gem 'devise' gem 'devise_token_auth', '>= 1.2.0', git: "https://github.com/lynndylanhurley/devise_token_auth" gem 'devise-i18n' group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "debug", platforms: %i[ mri mingw x64_mingw ] end group :development do # Speed up commands on slow machines / big apps [https://github.com/rails/spring] # gem "spring" end
回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。