ArgumentError : 無効なタイムゾーン: US/Pacific-New が 500 エラーを引き起こす

標準のインストールをアップグレードしたところ、タイムゾーンの問題で失敗しました。ユーザーは一人だけかもしれませんが、まだ確信が持てません。

それは一人のユーザーのためでした。彼のプロフィールにアクセスしたところ、タイムゾーンが設定されていませんでした。タイムゾーンを設定すると、問題は解決しました。

Started GET "/t/37040.json?track_visit=true&forceLoad=true" for 204.98.75.5 at 2023-03-23 21:36:37 +0000
Processing by TopicsController#show as JSON
  Parameters: {"track_visit"=>"true", "forceLoad"=>"true", "id"=>"37040"}
Completed 500 Internal Server Error in 48ms (ActiveRecord: 0.0ms | Allocations: 8345)
ArgumentError (Invalid Timezone: US/Pacific-New)
(eval):82:in `_fast_attributes'
app/serializers/post_stream_serializer_mixin.rb:54:in `block in posts'
app/serializers/post_stream_serializer_mixin.rb:47:in `map'
app/serializers/post_stream_serializer_mixin.rb:47:in `posts'
app/serializers/post_stream_serializer_mixin.rb:18:in `post_stream'
(eval):3:in `_fast_attributes'
app/controllers/application_controller.rb:545:in `render_json_dump'
app/controllers/topics_controller.rb:1242:in `block (2 levels) in perform_show_response'
app/controllers/topics_controller.rb:1232:in `perform_show_response'
app/controllers/topics_controller.rb:187:in `show'
app/controllers/application_controller.rb:414:in `block in with_resolved_locale'
app/controllers/application_controller.rb:414:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:74:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:369:in `call'
config/initializers/100-quiet_logger.rb:20:in `call'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/enforce_hostname.rb:24:in `call'
lib/middleware/request_tracker.rb:228:in `call'
Failed to handle exception in exception app middleware : ArgumentError : Invalid Timezone: US/Pacific-New
  Rendered text template (Duration: 0.0ms | Allocations: 1)
Started GET "/latest.json" for 172.220.127.141 at 2023-03-23 21:37:00 +0000
Processing by ListController#latest as JSON

編集:もしかしたら、彼のタイムゾーンがその偽の値に設定されていたのかもしれませんか?タイムゾーンがnilの別のユーザーを試しましたが、エラーはありませんでした。

「いいね!」 3

どのバージョンからアップグレードしましたか?

関連しているかもしれませんが(古いものですが)FIX: removes us_pacific-new from the list of available timezones by jjaffeux · Pull Request #10514 · discourse/discourse · GitHub

「いいね!」 5

すごい。よく見つけましたね。古いコミットから文字列を検索する方法をもっと学ぶ必要があります。GitHubのUIでそれをしますか?どこで?

最近のバージョン、1ヶ月以内のものです。新しいライブラリが何かを異なる方法で強制しない限り、これが今問題になるのは理にかなっていません。

だから、それは一時的なものか、あるいはそのコミットで無効になったタイムゾーンを持つユーザー設定を削除すべきだったのかもしれません。

「いいね!」 1
  1. 検索したいリポジトリに移動します
  2. 左上の検索ボックスに検索語を入力します

  1. クリックし、「このリポジトリ内」をクリックします

「いいね!」 2

それが6年もかかってわかったなんて信じられない!

「いいね!」 3

まだ解決できていないようです。

しかし、待ってください!長年見落としていた秘密がここにあります。

そして、「issues」をクリックすると……ついに!

本当にありがとうございました。

「いいね!」 1

まあ、私の推測では、US/Pacific-New をタイムゾーンとして選択できる期間があり、このユーザーがそれを行ったのでしょう。そして今、そのタイムゾーンを持つユーザーに対して何らかのライブラリが失敗しています。

UserOption.where("timezone like '%Pacific-New%'")

このタイムゾーンを持つ他のユーザーは見つからないので、このサイトでは二度と起こらないと思います。

「いいね!」 1