I have a Yesod app which I am deploying to Heroku in a Docker container. The app uses Amazon SES to send emails. When running the app locally using yesod devel this works fine, but in the container on Heroku I get the following error:
HttpExceptionRequest Request {
host = "email.eu-west-1.amazonaws.com"
port = 443
secure = True
requestHeaders = [("Content-Type","application/x-www-form-
urlencoded"),("Date","Wed, 20 Sep 2017 12:39:49 +0000"),("X-Amzn-
Authorization","AWS3-HTTPS AWSAccessKeyId=AKIAIBUN4ZEOKYKOB35A,
Algorithm=HmacSHA256,
Signature=xh3fi4EJOAe0LOZVCng5NRZIw2D+6P++0aO4Q5Dy0gw=")]
path = "/"
queryString = ""
method = "POST"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
(ConnectionFailure Network.BSD.getProtocolByName: does not exist (no
such protocol name: tcp))
I'm thinking I might need to install some extra packages in the container. Here's the Dockerfile:
FROM ubuntu:17.04
RUN apt-get update && apt-get install -y libpq-dev
WORKDIR /app
ADD . /app
EXPOSE 8080
ENV PGHOST localhost
CMD "./run"
Thanks to Michael Snoyman's hint, I found that netbase
is the package required to populate /etc/protocols
. After installing that, I got a new error complaining that the SSL cert for Amazon SES was from an unknown certificate authority.
I installed the ca-certificates
package, and this went away. I also came across an error telling me that libstdc++6
was not installed - so I installed that. All working now.
My final Dockerfile
that works with Yesod, using email auth and Amazon SES to send emails, is as follows (the "run" command is the compiled executable from stack build
):
FROM ubuntu:17.04
RUN apt-get update && apt-get install -y libpq-dev libgnutls30 netbase libstdc++6 ca-certificates
WORKDIR /app
ADD . /app
EXPOSE 8080
ENV PGHOST localhost
CMD "./run"
Hooray for trial and error :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With