ArgumentError : Invalid Timezone: US/Pacific-New causes 500 error

I have a standard install that I just upgraded that is failing due to a timezone issue. I think that it may be just one user, but I’m not quite sure yet.

It was for just one user. When I went to his profile his time zone was not set. When I set the time zone the issue went away.

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

EDIT: maybe he had his timezone set to that bogus value? I tried another user with a nil timezone and there was no error.

3개의 좋아요

From what version did you upgrade?

Maybe related (and old) FIX: removes us_pacific-new from the list of available timezones by jjaffeux · Pull Request #10514 · discourse/discourse · GitHub

5개의 좋아요

Wow. Good catch. I need to learn how to better search old commits for strings. Do you do that through the github ux? Where?

It was from a recent version, no more than a month ago. It doesn’t make sense that this would be an issue now unless some newer library is enforcing something differently.

So maybe it’s a fluke or maybe that commit should have removed user settings with that now-invalid time zone.

1개의 좋아요
  1. Go to the repository you want to search
  2. Enter search term in top left

  1. Click, and click 'in this repository"

2개의 좋아요

I’m not sure how it’s taken me 6 years to figure that out!

3개의 좋아요

Well, it seems that I still haven’t figured it out.

But wait! Here’s the secret that I’ve been missing all these years:

and if I click “issues” .. . . . finally!

Thanks so much.

1개의 좋아요

Well, my best guess is that there was a window of time that one could choose US/Pacific-New as a timezone, and this user did. And now some library fails for users with that time zone.

UserOption.where(“timezone like ‘%Pacific-New%’”)

finds no other users with that timezone, so I guess it won’t happen again on this site.

1개의 좋아요