Hoping someone can point me in the right direction because I’m really stuck…
I switched to AmazonSES and my emails were sending until I upgraded to Elixir 1.15.4. Now I’m getting this Oban error every time I try to send an emails:
{"{\"at\": \"2023-08-29T23:22:06.348323Z\", \"error\": \"** (ArgumentError) construction of binary failed: segment 2 of type 'binary': expected a binary but got: :error\\n (swoosh 1.11.5) lib/swoosh/adapters/amazon_ses.ex:261: Swoosh.Adapters.AmazonSES.generate_signature/4\\n (swoosh 1.11.5) lib/swoosh/adapters/amazon_ses.ex:196: Swoosh.Adapters.AmazonSES.prepare_header_authorization/4\\n (swoosh 1.11.5) lib/swoosh/adapters/amazon_ses.ex:183: Swoosh.Adapters.AmazonSES.prepare_headers/4\\n (swoosh 1.11.5) lib/swoosh/adapters/amazon_ses.ex:98: Swoosh.Adapters.AmazonSES.deliver/2\\n (my_app 0.1.0) lib/my_app/mail/mailer.ex:5: anonymous fn/2 in MyApp.Mail.Mailer.instrument/3\\n (telemetry 1.2.1) /Users/annad/MyApp/App/my_app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3\\n (oban 2.15.4) lib/oban/queue/executor.ex:129: Oban.Queue.Executor.perform/1\\n (oban 2.15.4) lib/oban/queue/executor.ex:74: Oban.Queue.Executor.call/1\\n (elixir 1.15.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2\\n (elixir 1.15.4) lib/task/supervised.ex:36: Task.Supervised.reply/4\\n\", \"attempt\": 1}"}
At first I thought I was getting this error because Amazon had me in the sandbox. But they freed me from the sandbox and the error kept happening.
I queue mail in Oban (throttling it using snooze), so I thought maybe I got out of sync with Oban releases when I upgraded Elixir. I decided to upgrade all of my apps related to mail, so I’m now on:
{:phoenix_swoosh, "~> 1.2"},
{:swoosh, "~> 1.11.5"},
{:gen_smtp, "~> 1.0"},
{:hackney, "~> 1.9"},
{:oban, "~> 2.15.4"},
That didn’t fix it.
I commented out my code except for the part that sends the mail to make sure it’s not my code.
I read this blog post by @ScriptyScott (which was excellent!), so I made the following addition to my config file:
config :swoosh, :api_client, Swoosh.ApiClient.Hackney
That didn’t do anything either. My config for the Swoosh.Adapters.AmazonSES is right out of the setup instructions. And it was working at one point with the new Amazon access keys, so I don’t think that’s the problem.
None of my email attempts are even getting to Amazon, because I’ve checked and it hasn’t processed anything. Based on the error message logged with Oban, it seems like the error must be happening in Swoosh or Oban.
I’m having a really hard time understanding the error message above. Hoping that maybe @sorentwo could help me understand which part of the Oban error message has the failure point.
Does anything jump out at anyone? I’ve honestly run out of things to try. Would appreciate any suggestions for areas to explore.