addict
addict copied to clipboard
Mailer failure doesn't show a reasonable error message
Love this project, thanks so much! This may be out of scope of Addict; I'm adding it as an issue to help others who run into it.
Walking through the readme
setup guide, I encountered an error when attempting to create an account on the /register
route.
Error:
[error] #PID<0.976.0> running Workshop.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /register
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in IO.chardata_to_string/1
(elixir) lib/io.ex:346: IO.chardata_to_string(nil)
(elixir) lib/path.ex:467: Path.join/2
(elixir) lib/path.ex:449: Path.join/1
lib/client.ex:44: Mailgun.Client.send_without_attachments/2
lib/addict/mailers/mailgun.ex:11: Addict.Mailers.Mailgun.send_email/4
lib/addict/interactors/register.ex:26: Addict.Interactors.Register.do_register/2
lib/addict/controller.ex:16: Addict.AddictController.register/2
lib/addict/controller.ex:1: Addict.AddictController.action/2
lib/addict/controller.ex:1: Addict.AddictController.phoenix_controller_pipeline/2
(workshop) lib/phoenix/router.ex:261: Workshop.Router.dispatch/2
(workshop) web/router.ex:1: Workshop.Router.do_call/2
(workshop) lib/workshop/endpoint.ex:1: Workshop.Endpoint.phoenix_pipeline/1
(workshop) lib/plug/debugger.ex:93: Workshop.Endpoint."call (overridable 3)"/2
(workshop) lib/phoenix/endpoint/render_errors.ex:34: Workshop.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
Steps to reproduce:
- Sign up for a mailgun account
- Do not active mailgun account (do not click the email verification link)
- Visit
/register/
endpoint and create an account. Server throws a 500.
Thanks @StephenGrider! I'll make sure to have that addressed too 😄
@StephenGrider Did you manage to get rid of the error?
Cheers.
@kevin-DL it seems what was missing was activating the mailgun account. Did you verify your e-mail address?
@trenpixster : yes i have, in my case i have looked into it and it seems like it's not retrieving the configuration information. I will check my config.exs to see if i might have made a typo.
That was it, some of my environment variables were not set properly.
Cheers.
It works on my local machine but not on heroku any ideas?
It works properly on my local machine but not on heroku. Any ideas?
I'm having this exact issue. I'm using the the sandbox API that Mailgun creates when you sign up as my DNS haven't yet been verified.
@kevin-DL what environment variables were missing in your case?
I've tried it on a real, verified, active domain associated to a verified Mailgun account, but it keeps on failing exactly like in the issue description.
I'm having the exact same problem. I've added mailgun through heroku and copied the API-url from the active sandbox domain into addict during installation. @kevin-DL also interested in those env variables you were missing :)
In my case for my local env i was missing the env variable for the mailgun key was not set properly so returned nil when accessed
It however does not work properly on heroku @Devalo for some reason. It was working at some point today but after an update it stopped working
In my case it fails with Addict 0.2.4 and Mailgun client 0.1.2.
I've tried with the same Mailgun credentials in the example app that comes with Addict, and I get this error instead:
➔ mix phoenix.server
[info] Running ExampleApp.Endpoint with Cowboy using http on port 4000
[info] POST /register
[debug] Processing by Addict.AddictController.register/2
Parameters: %{"email" => "[email protected]", "name" => "Jaime", "password" => "[FILTERED]"}
Pipelines: [:addict_routes]
[debug] INSERT INTO "users" ("inserted_at", "updated_at", "email", "encrypted_password", "name") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [{{2016, 5, 23}, {20, 8, 11, 0}}, {{2016, 5, 23}, {20, 8, 11, 0}}, "[email protected]", "$pbkdf2-sha512$100000$l8htaZWlZXlhPWuocUhlwA$QgMIHTOWP5ebC8ojmP.ZZovmbPFI0xKHPz90hy4PEu1cHUuJ/BV52T7CoOEUKuA6ZGsfDcHa5AufU5H4/ZTqbA", "Jaime"] OK query=147.7ms queue=21.6ms
[debug] Unable to send e-mail to [email protected]
:error
[debug] status: bad_fetch
[%{message: "Email: Unable to send e-mail (bad_fetch)"}]
[debug] reason:
[debug] no_scheme
[info] Sent 400 in 599ms
Really weird, everyone :| Can you try running mix deps.clean --all
an try again?
It works now! Thanks :) -- Tried it on the example app.
Did not work for me. I will re-try my heroku install from scratch and see how it goes
a mix deps.clean --all
helped for me, not sure why though
Yeah, same issue, and mix deps.clean --all
worked! Thank you! 😄
- Used
mix deps.clean --all
- Verified recipient emails were verified
Received error:
[debug] Unable to send e-mail to ga******@gmail.com
[debug] status: bad_fetch
[debug] reason:
[debug] no_scheme
In case this happens to anybody else, the issue was my mailgun_domain
in config :addict
it was mailgun_domain: sandboxXXXX.mailgun.org
had to change it to mailgun_domain: https://api.mailgun.net/v3/sandboxXXXX.mailgun.org
In case this happens to anybody else, the issue was my
mailgun_domain
inconfig :addict
it was
mailgun_domain: sandboxXXXX.mailgun.org
had to change it to
mailgun_domain: https://api.mailgun.net/v3/sandboxXXXX.mailgun.org
This sent me in the right direction.
The updated link was in the API section of my Sending domains in any of the pre-built programs.
In my case, they added a /messages to the end fo the domain...