Ruby version: jruby-9.1.5.0 (ruby-2.3.1)
Sidekiq / Pro / Enterprise version(s): Sidekiq
If relevant, please include your initializer and any error message with the full backtrace.
``[bash]
NoMethodError: undefined methodset' for Sidekiq::Web:Class
block in (root) at ~/app/config/routes.rb:23
routes.rb:23 has the same line from https://github.com/mperham/sidekiq/wiki/Monitoring#forbidden
``` [ruby]
# Rails >= 4:
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
And rails server fails to start
Web is also not working for us on production with passenger. Development works fine.
New syntax:
Sidekiq::Web.session_secret = Rails.application.secrets[:secret_key_base]
The old syntax will be supported in 4.2.1 out today.
We have a problem related to this using 4.2.1. We use github oauth in the sidekiq dashboard and we are getting undefined method error:
module Sidekiq
class Web
set :github_options, {
scopes: "user",
client_id: ENV["GITHUB_KEY"],
secret: ENV["GITHUB_SECRET"],
callback_url: "/sidekiq/auth/github/callback"
}
register Sinatra::Auth::Github
...
end
`set': undefined method `github_options=' for Sidekiq::Web:Class (NoMethodError)
Any idea how to workaround this?
You are trying to use a sinatra thing "Sinatra::Auth::Github" with Sidekiq::Web which does not use Sinatra anymore. You will need to move to generic Rack middleware.
Thanks @mperham but the same error raises for setting sessions in 4.2.1
https://github.com/mperham/sidekiq/issues/2910#issuecomment-206978212
``[bash]
NoMethodError: undefined methodsessions=' for Sidekiq::Web:Class
require 'sidekiq/web'
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
Sidekiq::Web.set :sessions, Rails.application.config.session_options
```
We don't support that option any more. Remove that line or comment it out.
I'm working on this, will have a better solution Monday.
@zoras & @mperham
Is there a solution for setting sessions as mentioned above?
Sidekiq::Web.set :sessions, domain: 'all'
We are seeing multiple sessions set and trying to limit to just one.
Currently on Sidekiq 4.2.0
We've configured Sidekiq::Web.session_secret = Rails.application.secrets[:secret_key_base], which works, but I think we still need a way to limit the number of sessions.
thanks
@dladowitz If you see a bug, your first step should be to upgrade to the latest version to ensure it hasn't already been fixed. https://github.com/mperham/sidekiq/blob/master/Changes.md#421
Great thanks. I wasn't sure if this was a bug exactly since you mentioned "We don't support that option any more".
Though it looks like 4.23 brigs back support for Sidekiq::Web.set :sessions
I'll try that.
@mperham Yep, after upgrading to 4.2.3 I'm able to use
Sidekiq::Web.set :sessions, domain: 'all'.
Thanks for the quick reply
.......hmmm looks like maybe we should be using Sidekiq::Web.set :sessions, false instead.
Most helpful comment
New syntax:
Sidekiq::Web.session_secret = Rails.application.secrets[:secret_key_base]