You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a bit confused and haven't been able to figure out what the issue is that I'm having. Running my app with dev env, i am not having any issues, but when I make a release, it seems there's a startup order issue or something else with tzdata.
Elixir: 1.14.5
Erlang: 25.3.2
OS: Ubuntu image from phx.gen.release --docker
When I boot my app:
04:34:11.599 [notice] Application google_certs exited: GoogleCerts.Application.start(:normal, []) returned an error: shutdown: failed to start child: GoogleCerts.CertificateCache
** (EXIT) an exception was raised:
** (ArgumentError) cannot add 23635 second to ~U[2023-06-14 04:34:11.592268Z] (with time zone database Tzdata.TimeZoneDatabase), reason: :time_zone_not_found
(elixir 1.14.5) lib/calendar/datetime.ex:1561: DateTime.add/4
(google_certs 1.0.0) lib/google_certs/client.ex:96: GoogleCerts.Client.expiration/1
(google_certs 1.0.0) lib/google_certs/client.ex:41: GoogleCerts.Client.get/1
(google_certs 1.0.0) lib/google_certs.ex:95: GoogleCerts.refresh/1
(elixir 1.14.5) lib/agent/server.ex:8: Agent.Server.init/1
(stdlib 4.3.1) gen_server.erl:851: :gen_server.init_it/2
(stdlib 4.3.1) gen_server.erl:814: :gen_server.init_it/6
(stdlib 4.3.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,google_certs,{{shutdown,{failed_to_start_child,'Elixir.GoogleCerts.CertificateCache',{#{'__exception__' => true,'__struct__' => 'Elixir.ArgumentError',message => <<\"cannot add 23635 second to ~U[2023-06-14 04:34:11.592268Z] (with time zone database Tzdata.TimeZoneDatabase), reason: :time_zone_not_found\">>},[{'Elixir.DateTime',add,4,[{file,\"lib/calendar/datetime.ex\"},{line,1561}]},{'Elixir.GoogleCerts.Client',expiration,1,[{file,\"lib/google_certs/client.ex\"},{line,96}]},{'Elixir.GoogleCerts.Client',get,1,[{file,\"lib/google_certs/client.ex\"},{line,41}]},{'Elixir.GoogleCerts',refresh,1,[{file,\"lib/google_certs.ex\"},{line,95}]},{'Elixir.Agent.Server',init,1,[{file,\"lib/agent/server.ex\"},{line,8}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,851}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,240}]}]}}},{'Elixir.GoogleCerts.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,google_certs,{{shutdown,{failed_to_start_child,'Elixir.GoogleCerts.CertificateCache',{#{'__exception__' => true,'__struct__' => 'Elixir.ArgumentError',message => <<"cannot add 23635 second to ~U[2023-06-14 04:34:11.592268Z] (with time zone database Tzdata.TimeZoneDatabase), reason: :time_zone_not_found">>},[{'Elixir.DateTime',add,4,[{file,"lib/calendar/datetime.ex"},{line,1561}]},{'Elixir.GoogleCerts.Client',expiration,1,[{file,"lib/google_certs/client.ex"},{line,96}]},{'Elixir.GoogleCerts.Client',get,1,[{file,"lib/google_certs/client.ex"},{line,41}]},{'Elixir.GoogleCerts',refresh,1,[{file,"lib/google_certs.ex"},{line,95}]},{'Elixir.Agent.Server',init,1,[{file,"lib/agent/server.ex"},{line,8}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,851}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,814}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,240}]}]}}},{'Elixir.GoogleCerts.Application',start,[normal,[]]}}})
I've already configured my app to use TzData: config :elixir, :time_zone_database, Tzdata.TimeZoneDatabase
I've also defined the start order in my mix.exs file:
{:tzdata, "~> 1.1"},
{:google_certs, "~> 1.0"},
Is there a missing time database or something I need to do in order to make this work?
The text was updated successfully, but these errors were encountered:
Hi, it looks like google_certs is doing a DateTime calculation during compile time. Since TzData is configured, but not started, TzData is called before it is started. That means the ets table is not available yet.
You can try this branch static-utc-period (https://github.com/lau/tzdata/tree/static-utc-period) temporarily and see if that fixes your problem. The static-utc-period won't be available forever. I plan to release a similar fix in a new version.
Hi,
I'm a bit confused and haven't been able to figure out what the issue is that I'm having. Running my app with dev env, i am not having any issues, but when I make a release, it seems there's a startup order issue or something else with tzdata.
Elixir: 1.14.5
Erlang: 25.3.2
OS: Ubuntu image from
phx.gen.release --docker
When I boot my app:
I've already configured my app to use TzData:
config :elixir, :time_zone_database, Tzdata.TimeZoneDatabase
I've also defined the start order in my mix.exs file:
Is there a missing time database or something I need to do in order to make this work?
The text was updated successfully, but these errors were encountered: