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
Sidekiq 6.2.0 raises Sidekiq::Web needs a valid Rack session for CSRF protection
in a rails app
#4850
Comments
Sidekiq::Web needs a valid Rack session for CSRF protection.
in a rails app even though mounting sidekiq inside the routesSidekiq::Web needs a valid Rack session for CSRF protection
in a rails app even though mounting sidekiq inside the routes
Sidekiq::Web needs a valid Rack session for CSRF protection
in a rails app even though mounting sidekiq inside the routesSidekiq::Web needs a valid Rack session for CSRF protection
in a rails app
It's not clear what the immediate cause is. Remove scheduler and enqueuer (any 3rd party Sidekiq extensions) and see if it works then. |
Oh, I believe the issue might be Rails API mode. You need to explicitly enable sessions in an API app if you want to mount a Rack app which depends on sessions: https://edgeguides.rubyonrails.org/api_app.html#using-session-middlewares |
We have an |
Added a sentence and link to the wiki: https://github.com/mperham/sidekiq/wiki/Monitoring#rails |
as also a bit explained in the wiki, you can also add session middleware only for sidekiq ui require 'sidekiq/web'
# Configure Sidekiq-specific session middleware
Sidekiq::Web.use ActionDispatch::Cookies
Sidekiq::Web.use ActionDispatch::Session::CookieStore, key: "_interslice_session"
Myapp::Application.routes.draw do
mount Sidekiq::Web => "/sidekiq"
# ...
end |
THAT solves the problem! |
when I use this code, actionpack (6.1.3.2) lib/action_dispatch/request/session.rb:235:in |
Hey @308820773 did you find a solution for this issue? |
Also worked for me on a Sinatra app. |
Upgrading sidekiq: 6.1.3 → 6.2.0 (minor) #4804 causes
Sidekiq::Web needs a valid Rack session for CSRF protection.
in a rails app even though we are mounting sidekiq inside the routes like so:Ruby version: '2.7.2'
Rails version:
6.1
Sidekiq / Pro / Enterprise version(s): 6.2.0
Initializer:
Error:
The text was updated successfully, but these errors were encountered: