6

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"
2
  • 2
    I'm on mobile right now and so I don't know the exact package name, but you need to install the apt package that provides /etc/protocols Sep 23, 2017 at 16:58
  • Thanks, that gives me somewhere to start looking!
    – Will
    Sep 25, 2017 at 9:38

1 Answer 1

6

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 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.