pablo-co / bamboo_postmark

A Bamboo adapter for Postmark
MIT License
39 stars 29 forks source link

API Error with no details #29

Closed DavidVII closed 3 years ago

DavidVII commented 5 years ago

Hello there, I am getting the following error, but it doesn’t really provide any insights into what the error actually is and I, therefore, can't figure out how to go about fixing it.

Running this code triggers the following error:

user |> MyApp.Email.password_reset("TOKEN") |> MyApp.Mailer.deliver_now()
** (Bamboo.PostmarkAdapter.ApiError) {:option, :server_only, :honor_cipher_order}
    (bamboo_postmark) lib/bamboo/postmark_adapter.ex:65: Bamboo.PostmarkAdapter.deliver/2
    (bamboo) lib/bamboo/mailer.ex:145: Bamboo.Mailer.deliver_now/4

The API key is present in the env and I’m able to pull it up using System.get_env(“MY_API_KEY”). To make things extra fun, everything works as expected in development, but not in production even though dev/prod share the same configuration in this case.

In config.exs

config :my_app, MyApp.Mailer,
  adapter: Bamboo.PostmarkAdapter,
  api_key: System.get_env("POSTMARK_API_KEY")

Any pointers here would be greatly appreciated. I'd be open to opening a PR up if necessary, but perhaps I'm just missing something?

Thanks for your time 😊

DavidVII commented 5 years ago

It looks like hackney was updated last month to version 1.15.2, which fixed a bug where SSL requests would break. This makes sense since my local machine doesn't use SSL, but production does.

The fix was to run mix deps.update hackney to update hackney in the lock file to 1.15.2.

Everything works as expected after doing that and pushing to production.

Not sure if there's anything we need to do here since it's not an issue with this adapter, but maybe it'd be nice to use the latest version of hackney? Not really sure.

Here's the related issue on hackney: https://github.com/benoitc/hackney/issues/591