vincentopensourcetai
Error when sending the confirmation email
I use Phoenix 1.7, “mix phx.gen.auth”, and set up my email with the following code.
# config/config.exs
config :hello, Hello.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: System.get_env("SENDGRID_API_KEY")
config :swoosh, :api_client, Swoosh.ApiClient.Finch
When I register a user, I get the following error message.
[error] GenServer #PID<0.601.0> terminating
** (UndefinedFunctionError) function false.post/4 is undefined (module false is not available)
false.post(["https://api.sendgrid.com/v3", "/mail/send"], [{"Content-Type", "application/json"}, {"User-Agent", "swoosh/1.9.1"}, {"Authorization", "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}], "{\"content\":[{\"type\":\"text/plain\",\"value\":\"\\n==============================\\n\\nHi vincent.open.source.taiwan@gmail.com,\\n\\nYou can confirm your account by visiting the URL below:\\n\\nhttp://localhost:4000/users/confirm/uejATJ8x_lsnnYTnEH7s_GMOUztU_jubWsIc4ovHeVg\\n\\nIf you didn't create an account with us, please ignore this.\\n\\n==============================\\n\"}],\"from\":{\"email\":\"service@word.today\",\"name\":\"Hello\"},\"personalizations\":[{\"to\":[{\"email\":\"vincent.open.source.taiwan@gmail.com\"}]}],\"subject\":\"Confirmation instructions\"}", %Swoosh.Email{subject: "Confirmation instructions", from: {"Hello", "service@word.today"}, to: [{"", "vincent.open.source.taiwan@gmail.com"}], cc: [], bcc: [], text_body: "\n==============================\n\nHi vincent.open.source.taiwan@gmail.com,\n\nYou can confirm your account by visiting the URL below:\n\nhttp://localhost:4000/users/confirm/uejATJ8x_lsnnYTnEH7s_GMOUztU_jubWsIc4ovHeVg\n\nIf you didn't create an account with us, please ignore this.\n\n==============================\n", html_body: nil, attachments: [], reply_to: nil, headers: %{}, private: %{}, assigns: %{}, provider_options: %{}})
(swoosh 1.9.1) lib/swoosh/adapters/sendgrid.ex:128: Swoosh.Adapters.Sendgrid.deliver/2
(hello 0.1.0) lib/hello/mailer.ex:2: anonymous fn/2 in Hello.Mailer.instrument/3
(telemetry 1.2.1) /Users/vincentlin/projects/hello/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(hello 0.1.0) lib/hello/accounts/user_notifier.ex:15: Hello.Accounts.UserNotifier.deliver/3
(hello 0.1.0) lib/hello_web/live/user_registration_live.ex:60: HelloWeb.UserRegistrationLive.handle_event/3
(phoenix_live_view 0.18.16) lib/phoenix_live_view/channel.ex:396: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /Users/vincentlin/projects/hello/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.18.16) lib/phoenix_live_view/channel.ex:216: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.2) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.2) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F0dIUxRFO5LYlQKD", event: "event", payload: %{"event" => "save", "type" => "form", "value" => "_csrf_token=Jx9bNy8wHDIlPwQMen0McHALCTIGdxcCwfhTNylmIkI45DXI3NBgQZXJ&user%5Bemail%5D=vincent.open.source.taiwan%40gmail.com&user%5Bpassword%5D=12345678901234567890"}, ref: "35", join_ref: "33"}
State: %{components: {%{}, %{}, 1}, join_ref: "33", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<id: "phx-F0dIUxRFO5LYlQKD", endpoint: HelloWeb.Endpoint, view: HelloWeb.UserRegistrationLive, parent_pid: nil, root_pid: #PID<0.601.0>, router: HelloWeb.Router, assigns: %{__changed__: %{}, check_errors: false, current_user: nil, flash: %{}, form: nil, live_action: :new, trigger_submit: false}, transport_pid: #PID<0.594.0>, ...>, topic: "lv:phx-F0dIUxRFO5LYlQKD", upload_names: %{}, upload_pids: %{}}
How do I solve the error?
Many thanks for your replying.
Marked As Solved
jerdew
Could your config be set to ‘false’ in an environment specific config?
It looks like you may have config :swoosh, :api_client, false set somewhere
1
Also Liked
vincentopensourcetai
Many thanks for your reply.
I update my config as follows and it works.
# config/config.exs
config :hello, Hello.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: System.get_env("SENDGRID_API_KEY")
# config/dev.exs
config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: Hello.Finch
1
rio517
I ran into a loosly related issue and just wanted to document it somewhere.
(ArgumentError) unknown registry: PetalPro.Finch
(elixir 1.14.4) lib/registry.ex:1382: Registry.key_info!/1
(elixir 1.14.4) lib/registry.ex:580: Registry.lookup/2
(finch 0.15.0) lib/finch/pool_manager.ex:44: Finch.PoolManager.lookup_pool/2
(finch 0.15.0) lib/finch/pool_manager.ex:34: Finch.PoolManager.get_pool/2
(finch 0.15.0) lib/finch.ex:284: Finch.__stream__/5
(finch 0.15.0) lib/finch.ex:324: anonymous fn/4 in Finch.request/3
(telemetry 1.2.1) /app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(swoosh 1.9.1) lib/swoosh/api_client/finch.ex:59: Swoosh.ApiClient.Finch.post/4
The :finch_name didn’t match what was set in my application.ex supervisory tree.
1
Popular in Questions
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir?
...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Other popular topics
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help.
Where are they similar?
Where do they differ the m...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
Got a question about when to concat vs. prepending items to list then reversing to achieve appending.
So i know lists boil down to [1 | ...
New
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphena...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










