janko / rodauth-rails

Rails integration for Rodauth authentication framework
https://github.com/jeremyevans/rodauth
MIT License
584 stars 40 forks source link

rails 7.2-beta3 error #309

Closed 34code closed 1 month ago

34code commented 1 month ago

getting the following error on /login with rails 7.2beta3

NoMethodError - undefined method `parameter_filter' for nil: 00:25:32 web.1 | app/misc/rodauth_app.rb:13:in `block in <class:RodauthApp>'

and my rodauth_app.rb

class RodauthApp < Rodauth::Rails::App
  # primary configuration
  configure RodauthMain

  # secondary configuration
  # configure RodauthAdmin, :admin

  route do |r|
    rodauth.load_memory # autologin remembered users

    r.rodauth # route rodauth requests

    # ==> Authenticating requests
    # Call `rodauth.require_account` for requests that you want to
    # require authentication for. For example:
    #
    # # authenticate /dashboard/* and /account/* requests
    # if r.path.start_with?("/dashboard") || r.path.start_with?("/account")
    #   rodauth.require_account
    # end

    # ==> Secondary configurations
    # r.rodauth(:admin) # route admin rodauth requests
  end
end
34code commented 1 month ago

I think something in the new rails is calling .parameter_filter on r.rodauth which returns nil

34code commented 1 month ago

seems like the problem is no more.. false alarm i think

34code commented 1 month ago

actually i discovered this happens on my alpha testing site.. is there a way to configure rodauth on multiple domains? So I'm receiving this error on the alpha.botflip.com domain but not on my primary botflip.com domain

e.g. in app/misc/rodauth_main.rb

domain "botflip.com"

v/s something like

domain ["botfip.com", "alpha.botflip.com"]

34code commented 1 month ago

I'm using one auth database across multiple domains. I guess I should have checked if this is possible with rodauth-rails first?

janko commented 1 month ago

If you don't set the domain and just let Rodauth generate URLs from the current hostname, shouldn't everything work fine? At which point to domains get crossed, what specifically do you think rodauth-rails doesn't handle? I'm not sure I can do anything without a backtrace or a reproduction app, currently I have little to go on.

34code commented 1 month ago

actually just trying that exact thing! removing the domain as well as base_url.. Hoping it works! will report back..

34code commented 1 month ago

i removed those two config variables but im still getting the same error on my alpha.botflip.com domain.. Heres a trace..

[11127f4a-8649-46bb-9fcb-b2b0ed13f876] Processing by Rails::HealthController#show as */*
[11127f4a-8649-46bb-9fcb-b2b0ed13f876] [ahoy] Visit excluded
[11127f4a-8649-46bb-9fcb-b2b0ed13f876]   Rendering html template
[11127f4a-8649-46bb-9fcb-b2b0ed13f876]   Rendered html template (Duration: 0.1ms | GC: 0.0ms)
[11127f4a-8649-46bb-9fcb-b2b0ed13f876] Completed 200 OK in 2ms (Views: 0.6ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] Started POST "/login" for 67.180.1.189 at 2024-07-24 08:21:13 +0000
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] Processing by RodauthController#login as HTML
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   Parameters: {"authenticity_token"=>"[FILTERED]", "email"=>"sambehera@gmail.com", "password"=>"[FILTERED]", "commit"=>"Login"}
"INSIDE CAPTCHA CHECK HERE - generic"
nil
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   Sequel (189.1ms)  SELECT * FROM "accounts" WHERE (("email" = 'sambehera@gmail.com') AND ("status" IN (1, 2))) LIMIT 1
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   TRANSACTION (189.1ms)  BEGIN
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   Sequel (189.2ms)  DELETE FROM "account_email_auth_keys" WHERE ("id" = 2)
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   Sequel (186.7ms)  SELECT "key" FROM "account_remember_keys" WHERE (("id" = 2) AND ("deadline" > CURRENT_TIMESTAMP)) LIMIT 1
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   Sequel (186.3ms)  SELECT "deadline" FROM "account_remember_keys" WHERE (("id" = 2) AND ("deadline" > CURRENT_TIMESTAMP)) LIMIT 1
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   TRANSACTION (185.3ms)  COMMIT
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] Redirected to 
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] Completed 302 Found in 1532ms (ActiveRecord: 1125.5ms (4 queries, 0 cached) | GC: 0.0ms)
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] NoMethodError (undefined method `parameter_filter' for nil):
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc]   
[f71f6b74-9960-4a7c-a6d9-2541df58d4cc] app/misc/rodauth_app.rb:11:in `block in <class:RodauthApp>'
[d8d3df6a-d769-4466-b7c3-938f8ce97943] Started GET "/up" for 127.0.0.1 at 2024-07-24 08:21:22 +0000
[d8d3df6a-d769-4466-b7c3-938f8ce97943] Processing by Rails::HealthController#show as */*
[d8d3df6a-d769-4466-b7c3-938f8ce97943] [ahoy] Visit excluded
[d8d3df6a-d769-4466-b7c3-938f8ce97943]   Rendering html template
[d8d3df6a-d769-4466-b7c3-938f8ce97943]   Rendered html template (Duration: 0.0ms | GC: 0.0ms)
[d8d3df6a-d769-4466-b7c3-938f8ce97943] Completed 200 OK in 2ms (Views: 0.4ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 0.0ms)
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5] Started GET "/up" for 127.0.0.1 at 2024-07-24 08:21:32 +0000
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5] Processing by Rails::HealthController#show as */*
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5] [ahoy] Visit excluded
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5]   Rendering html template
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5]   Rendered html template (Duration: 0.0ms | GC: 0.0ms)
[183c74b2-66ac-4cd5-ab21-24c6e443f6c5] Completed 200 OK in 580ms (Views: 0.8ms | ActiveRecord: 0.0ms (0 queries, 0 cached) | GC: 200.9ms)
[eda14a2f-38f7-4492-baf9-550fb4f091b4] Started GET "/up" for 127.0.0.1 at 2024-07-24 08:21:43 +0000
[eda14a2f-38f7-4492-baf9-550fb4f091b4] Processing by Rails::HealthController#show as */*
34code commented 1 month ago

I'm on rails 7.2beta3 btw

janko commented 1 month ago

This is not a backtrace of the exception, it's just logging around it. If you're able to receive this error in the browser, the error page should allow you to see the full trace. What's currently shown is just that it's coming from the r.rodauth call, which I already guessed.

34code commented 1 month ago

Thanks for the quick response! here's the full trace in development.


[actionpack (7.2.0.beta3) lib/action_dispatch/http/filter_redirect.rb:41:in `block in parameter_filtered_location'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/http/filter_redirect.rb:40:in `gsub!'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/http/filter_redirect.rb:40:in `parameter_filtered_location'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/http/filter_redirect.rb:14:in `filtered_location'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:71:in `block in rails_instrument_redirection'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/hooks/active_support_notifications.rb:19:in `block in instrument'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/notifications/instrumenter.rb:58:in `instrument'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/hooks/active_support_notifications.rb:18:in `instrument'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:66:in `rails_instrument_redirection'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/internal_request.rb:38:in `rails_instrument_redirection'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:14:in `redirect'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/login.rb:149:in `_login_response'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/base.rb:873:in `require_response'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/login.rb:94:in `login'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/login.rb:74:in `block (4 levels) in <module:Rodauth>'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/base.rb:636:in `catch'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/base.rb:636:in `catch_error'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/login.rb:47:in `block (3 levels) in <module:Rodauth>'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/request.rb:536:in `always'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:32:in `block in always'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:32:in `catch'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:32:in `always'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/request.rb:527:in `_verb'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/request.rb:273:in `post'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/login.rb:43:in `block (2 levels) in <module:Rodauth>'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth.rb:145:in `block (3 levels) in route'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/base.rb:538:in `_around_rodauth'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:12:in `block in _around_rodauth'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:21:in `block (3 levels) in rails_controller_around'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:21:in `catch'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:21:in `block (2 levels) in rails_controller_around'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/csrf.rb:41:in `block in rails_controller_callbacks'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:121:in `block in run_callbacks'](http://localhost:3002/login#)
[turbo-rails (2.0.6) lib/turbo-rails.rb:24:in `with_request_id'](http://localhost:3002/login#)
[turbo-rails (2.0.6) app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:130:in `block in run_callbacks'](http://localhost:3002/login#)
[ahoy_matey (5.1.0) lib/ahoy/controller.rb:50:in `set_ahoy_request_store'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:130:in `block in run_callbacks'](http://localhost:3002/login#)
[actiontext (7.2.0.beta3) lib/action_text/rendering.rb:25:in `with_renderer'](http://localhost:3002/login#)
[actiontext (7.2.0.beta3) lib/action_text/engine.rb:71:in `block (4 levels) in <class:Engine>'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:130:in `instance_exec'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:130:in `block in run_callbacks'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:141:in `run_callbacks'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:32:in `rails_controller_callbacks'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/csrf.rb:38:in `rails_controller_callbacks'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:20:in `block in rails_controller_around'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:37:in `rails_controller_rescue'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:19:in `rails_controller_around'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/internal_request.rb:28:in `rails_controller_around'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/callbacks.rb:12:in `_around_rodauth'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:10:in `block in _around_rodauth'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:50:in `block (2 levels) in rails_instrument_request'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:50:in `catch'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:50:in `block in rails_instrument_request'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/hooks/active_support_notifications.rb:19:in `block in instrument'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/notifications/instrumenter.rb:58:in `instrument'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/hooks/active_support_notifications.rb:18:in `instrument'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:49:in `rails_instrument_request'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/internal_request.rb:33:in `rails_instrument_request'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/feature/instrumentation.rb:10:in `_around_rodauth'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth.rb:143:in `block (2 levels) in route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/request.rb:603:in `if_match'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:38:in `block in if_match'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:38:in `catch'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/pass.rb:38:in `if_match'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/request.rb:199:in `is'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth.rb:140:in `block in route'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth/features/base.rb:169:in `route!'](http://localhost:3002/login#)
[rodauth-omniauth (0.3.4) lib/rodauth/features/omniauth_base.rb:44:in `route!'](http://localhost:3002/login#)
[rodauth (2.36.0) lib/rodauth.rb:444:in `rodauth'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/app.rb:70:in `rodauth'](http://localhost:3002/login#)
[app/misc/rodauth_app.rb:11:in `block in <class:RodauthApp>'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:522:in `_roda_run_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/middleware.rb:207:in `_roda_run_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/_before_hook.rb:27:in `_roda_run_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:500:in `block in _roda_handle_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:498:in `catch'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:498:in `_roda_handle_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/error_handler.rb:88:in `_roda_handle_main_route'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:384:in `block in base_rack_app_callable'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda.rb:53:in `call'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/middleware.rb:159:in `block in call'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/middleware.rb:157:in `catch'](http://localhost:3002/login#)
[roda (3.82.0) lib/roda/plugins/middleware.rb:157:in `call'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/middleware.rb:18:in `block in call'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/middleware.rb:17:in `catch'](http://localhost:3002/login#)
[rodauth-rails (1.14.1) lib/rodauth/rails/middleware.rb:17:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/static.rb:161:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/tempfile_reaper.rb:20:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/etag.rb:29:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/conditional_get.rb:43:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/head.rb:15:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/http/permissions_policy.rb:38:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/http/content_security_policy.rb:36:in `call'](http://localhost:3002/login#)
[rack-session (2.0.0) lib/rack/session/abstract/id.rb:272:in `context'](http://localhost:3002/login#)
[rack-session (2.0.0) lib/rack/session/abstract/id.rb:266:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/cookies.rb:704:in `call'](http://localhost:3002/login#)
[activerecord (7.2.0.beta3) lib/active_record/migration.rb:674:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/callbacks.rb:31:in `block in call'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/callbacks.rb:101:in `run_callbacks'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/callbacks.rb:30:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/executor.rb:16:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/rack/abstract_middleware.rb:92:in `call_app'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/rack/abstract_middleware.rb:87:in `instrument_app_call'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/rack/abstract_middleware.rb:111:in `instrument_app_call_with_exception_handling'](http://localhost:3002/login#)
[appsignal (3.12.0) lib/appsignal/rack/abstract_middleware.rb:52:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/debug_exceptions.rb:31:in `call'](http://localhost:3002/login#)
[web-console (4.2.1) lib/web_console/middleware.rb:132:in `call_app'](http://localhost:3002/login#)
[web-console (4.2.1) lib/web_console/middleware.rb:28:in `block in call'](http://localhost:3002/login#)
[web-console (4.2.1) lib/web_console/middleware.rb:17:in `catch'](http://localhost:3002/login#)
[web-console (4.2.1) lib/web_console/middleware.rb:17:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'](http://localhost:3002/login#)
[railties (7.2.0.beta3) lib/rails/rack/logger.rb:41:in `call_app'](http://localhost:3002/login#)
[railties (7.2.0.beta3) lib/rails/rack/logger.rb:29:in `call'](http://localhost:3002/login#)
[ahoy_matey (5.1.0) lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'](http://localhost:3002/login#)
[propshaft (af557fbd10dc) lib/propshaft/quiet_assets.rb:11:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/remote_ip.rb:96:in `call'](http://localhost:3002/login#)
[request_store (1.7.0) lib/request_store/middleware.rb:19:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/request_id.rb:33:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/method_override.rb:28:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/runtime.rb:24:in `call'](http://localhost:3002/login#)
[activesupport (7.2.0.beta3) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/server_timing.rb:60:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/executor.rb:16:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/static.rb:27:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/sendfile.rb:114:in `call'](http://localhost:3002/login#)
[actionpack (7.2.0.beta3) lib/action_dispatch/middleware/host_authorization.rb:143:in `call'](http://localhost:3002/login#)
[rack (3.1.7) lib/rack/events.rb:116:in `call'](http://localhost:3002/login#)
[railties (7.2.0.beta3) lib/rails/engine.rb:535:in `call'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/configuration.rb:272:in `call'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/request.rb:100:in `block in handle_request'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/thread_pool.rb:378:in `with_force_shutdown'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/request.rb:99:in `handle_request'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/server.rb:464:in `process_client'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/server.rb:245:in `block in run'](http://localhost:3002/login#)
[puma (6.4.2) lib/puma/thread_pool.rb:155:in `block in spawn_thread'](http://localhost:3002/login#)
Request
Parameters:

{"authenticity_token"=>"[FILTERED]", "email"=>"sambehera@gmail.com", "password"=>"[FILTERED]", "commit"=>"Login"}```
janko commented 1 month ago

Thanks, I appreciate the backtrace 🙏🏻

The error is odd, it seems like ActionDispatch::Response#request is nil, but rodauth-rails is setting it. I tried upgrading to 7.2.0.beta3 on the rodauth-demo-rails app, adding 127.0.0.1 foo.example.test to /etc/hosts, adding config.hosts << "foo.example.test" to config/application.rb, but I was able to successfully login while on foo.example.test.

Any chance you could reproduce it in the official demo app?

janko commented 1 month ago

Found it, it's not about subdomains, but about query parameters, I was able to reproduce it by setting login_redirect "/?foo=bar". rodauth-rails instrumentation doesn't initialize the ActionDispatch::Response correctly (it doesn't set the #request), so if Rodauth redirects to a route with query parameters, it hits a code path inside Action Pack that requires #request to be set.

I'll push a fix shortly.

34code commented 1 month ago

Thank you!