LoginSignup
1
0

More than 3 years have passed since last update.

Sidekiqの管理画面で500エラーが発生

Posted at

Sidekiqの管理画面(Sidekiq::Web)で500エラーが発生しており、無事に解決できたので、対応方法をまとめておきます。

開発環境

  • Rails: 5.2.3
  • Ruby: 2.6.3
  • rack: 2.2.3
  • Redis: 4.1.2
  • Sidekiq: 6.0.0

発生していたエラー

NoMethodError (undefined method `match' for #<Rack::Session::SessionId:xxxxxxxxxxxxxx>):

やったこと

試してみたこと

1.セッションを消してみる
2.rackをアップデート
3.bundle updateしてみる

解決した方法

4.redis-rackをアップデートしてみる
5.redis-actionpackをアップデートしてみる


1.セッションを消してみる

config/routes.rb
require 'sidekiq/web'
Sidekiq::Web.set :sessions, false # 追加

管理画面は表示されるが、セッションを消しているだけなので、
根本的な解決とはなっていない。

2.rackをアップデート

bundle update rack

Note: rack version regressed from 2.2.3 to 2.0.9

エラーが変わらず。

3.bundle updateしてみる

bundle update
正常に動いたのでgemに問題がありそう。
今回の修正範囲以外にも影響が大きいため、gem全てがアップデートされるbundle updateは避けて、
一旦もとに戻して原因を探る。


4.redis-rackをアップデートしてみる

bundle update redis-rack

管理画面は正常に表示されたが、テストが失敗してしまう。

NoMethodError:
  undefined method `private_id' for "xxxxxxxxxxxxxxx":String
  Did you mean?  private_methods

5.redis-actionpackをアップデートしてみる

上記のredis-rackのアップデート実行後、
こちらの記事
https://github.com/redis-store/redis-rack/pull/50#issuecomment-567649953
を参考に
bundle update redis-actionpack

これでサーバー再起動後、Sidekiqの管理画面の500エラーが解消し、テストも通った。

まとめ

redis-rackredis-actionpackのアップデートで解決しました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0