antp/mailer

:tzdata is missing

Closed this issue · 5 comments

hykw commented

Without :tzdata in application, Mailer.compose_email() causes the following error:

Request: GET /register
** (exit) an exception was raised:
    ** (ArgumentError) argument error
        (stdlib) :ets.lookup(:tzdata_current_release, :release_version)
        lib/tzdata/release_reader.ex:41: Tzdata.ReleaseReader.current_release_from_table/0
        lib/tzdata/release_reader.ex:13: Tzdata.ReleaseReader.simple_lookup/1
        lib/tzdata/release_reader.ex:7: Tzdata.ReleaseReader.zone_and_link_list/0
        lib/tzdata.ex:61: Tzdata.zone_exists?/1
        lib/timezone/timezone.ex:117: Timex.Timezone.get/2
        lib/date/date.ex:171: Timex.Date.local/0
        lib/mailer.ex:136: Mailer.compose_email_by_type/5
        (login_study) web/controllers/register_controller.ex:15: LoginStudy.RegisterController.new/2
        (login_study) web/controllers/register_controller.ex:1: LoginStudy.RegisterController.action/2
        (login_study) web/controllers/register_controller.ex:1: LoginStudy.RegisterController.phoenix_controller_pipeline/2
        (login_study) lib/phoenix/router.ex:261: LoginStudy.Router.dispatch/2
        (login_study) web/router.ex:1: LoginStudy.Router.do_call/2
        (login_study) lib/login_study/endpoint.ex:1: LoginStudy.Endpoint.phoenix_pipeline/1
        (login_study) lib/plug/debugger.ex:92: LoginStudy.Endpoint."call (overridable 3)"/2
        (login_study) lib/phoenix/endpoint/render_errors.ex:34: LoginStudy.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

It worked well, if you added :tzdata

  def application do
      [mod: {LoginStudy, []},
        applications: [
          :phoenix,
          :phoenix_html,
          :cowboy,
          :logger,
          :gettext,
          :phoenix_ecto,

          :tzdata
        ]]
    end
antp commented

tzdata added, thanks

Heya, I still get this with a stock install of mailer. It works if I add :tzdata to my own projects applications though.

antp commented

I just created a test Elixir app and added Mailer. All worked fine.
What version of the mailer are you using?

Here is the mix file for the test app:

defmodule MTest.Mixfile do
use Mix.Project

def project do
[app: :m_test,
version: "0.0.1",
elixir: "~> 1.2",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end

Configuration for the OTP application

Type "mix help compile.app" for more information

def application do
[applications: [:logger, :mailer]]
end

Dependencies can be Hex packages:

{:mydep, "~> 0.3.0"}

Or git/path repositories:

{:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}

Type "mix help deps" for more examples and options

defp deps do
[{:mailer, "~> 1.0"}]
end
end

This is the Iex output

iex(1)>
16:23:44.373 [debug] Tzdata polling for update.

16:23:47.233 [debug] Tzdata downloading new data from https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz

16:23:49.002 [debug] Tzdata data downloaded. Release version 2016d.

16:23:51.293 [info] Tzdata has updated the release from 2016c to 2016d

16:23:51.293 [debug] Tzdata deleting ETS table for version 2016c

16:23:51.294 [debug] Tzdata deleting ETS table file for version 2016c

Ah, operational error on my part, I didn't realize I needed to start :mailer in my mixfile. Thanks!

antp commented

No problem