NoMethodError (undefined method `keys' for nil:NilClass)

AI-generated summary

The discussion revolves around a NoMethodError (undefined method 'keys' for nil:NilClass) error encountered when trying to log in to a Discourse forum version 3.1.4. mdhont shared the error message from the production.log, which includes the stacktrace. RGJ suggested a possible solution by linking to a similar issue in the meta discourse forum. mdhont acknowledged the response and apologized for not finding the solution earlier.

Hi,

Bitnami Developer here, when trying to login on version 3.1.4 I’m getting an “unexpected problem” warning. The production.log shows an undefined method `keys’ error:

Completed 200 OK in 7ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 716)
Started POST "/session" for 188.78.137.42 at 2024-01-12 13:05:34 +0000
Processing by SessionController#create as */*
  Parameters: {"login"=>"user", "password"=>"[FILTERED]", "second_factor_method"=>"1", "timezone"=>"Europe/Madrid"}
Completed 200 OK in 930ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 236460)
Started POST "/login" for 188.78.137.42 at 2024-01-12 13:05:35 +0000
Processing by StaticController#enter as HTML
  Parameters: {"username"=>"user", "password"=>"[FILTERED]", "redirect"=>"https://xx.xx.xx.xx/"}
Redirected to https://xx.xx.xx.xx/
Completed 302 Found in 12ms (ActiveRecord: 0.0ms | Allocations: 3468)
Started GET "/" for 188.78.137.42 at 2024-01-12 13:05:35 +0000
Processing by ListController#latest as HTML
Completed 500 Internal Server Error in 299ms (ActiveRecord: 0.0ms | Allocations: 142313)
NoMethodError (undefined method `keys' for nil:NilClass)
(eval):76:in `_fast_attributes'
app/controllers/application_controller.rb:650:in `preload_current_user_data'
app/controllers/application_controller.rb:445:in `preload_json'
....

Specifications:

  • Debian 11
  • Ruby 3.2.2
  • Postgresql 16.1
  • Node 18.19.0
  • Redis 7.0

Searching gives you this as the second result (top result before you made your post)

My apologies, thanks for the quick reply.