Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure to mount Rack Middleware in routes using kwargs #1293

Closed

Conversation

jodosha
Copy link
Member

@jodosha jodosha commented Feb 28, 2023

Problem

Given the following route scope with a middleware that accepts kwargs:

    scope "/sidekiq" do
      use Rack::Session::Cookie,
          key: "_my_app.session",
          secret: Hanami.app.settings.session_secret,
          expire_after: 60 * 60 * 24 * 365

      mount Sidekiq::Web, at: "/sidekiq"
    end

The app crashes with the following:

    ArgumentError:
       unknown keyword: :secret
     # ./lib/hanami/slice/routing/middleware/stack.rb:94:in `use'

@jodosha jodosha added this to the v2.0.4 milestone Feb 28, 2023
@wuarmin
Copy link
Contributor

wuarmin commented Feb 29, 2024

Hey 👋 @jodosha,

what is the status here? I ask, because following issue still exists https://discourse.hanamirb.org/t/how-to-enable-http-sessions-only-for-sub-route/799

At the moment I have to deactivate verify_csrf_token at my actions so that I can use the Sidekiq frontend.

thanks

@timriley
Copy link
Member

timriley commented Mar 2, 2024

This is now fixed by #1370 (and hanami/router#267). Both are released as part of Hanami 2.1.0.

@timriley timriley closed this Mar 2, 2024
@timriley
Copy link
Member

timriley commented Mar 2, 2024

@wuarmin If you could have another try with 2.1.0 and let me know how you go, that'd be great, thanks!

@timriley timriley deleted the ensure-to-mount-middleware-in-routes-using-kwargs branch March 2, 2024 10:16
@wuarmin
Copy link
Contributor

wuarmin commented Apr 10, 2024

@timriley Thanks! It now works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants