Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Verification Failure on Docker Alpine Python 3.5 #47

Open
digitaldavenyc opened this issue Dec 20, 2016 · 8 comments
Open

SSL Verification Failure on Docker Alpine Python 3.5 #47

digitaldavenyc opened this issue Dec 20, 2016 · 8 comments

Comments

@digitaldavenyc
Copy link

We are trying to get setup with Send Grid using this library and receiving the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/lib/python3.5/site-packages/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/var/doorman/communication/tasks.py", line 34, in send
    mail.send()
  File "/usr/lib/python3.5/site-packages/django/core/mail/message.py", line 342, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/lib/python3.5/site-packages/sgbackend/mail.py", line 68, in send_messages
    self.sg.client.mail.send.post(request_body=mail)
  File "/usr/lib/python3.5/site-packages/python_http_client/client.py", line 204, in http_request
    return Response(self._make_request(opener, request))
  File "/usr/lib/python3.5/site-packages/python_http_client/client.py", line 138, in _make_request
    return opener.open(request)
  File "/usr/lib/python3.5/urllib/request.py", line 466, in open
    response = self._open(req, data)
  File "/usr/lib/python3.5/urllib/request.py", line 484, in _open
    '_open', req)
  File "/usr/lib/python3.5/urllib/request.py", line 444, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.5/urllib/request.py", line 1297, in https_open
    context=self._context, check_hostname=self._check_hostname)
  File "/usr/lib/python3.5/urllib/request.py", line 1256, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>

Our setup is:

  • Django 1.10
  • Python 3.5
  • Docker
  • Alpine OS (latest)
@andriisoldatenko
Copy link
Collaborator

@digitaldavenyc Can you please show me your Dockerfile?

@digitaldavenyc
Copy link
Author

Sure

FROM alpine

ENV PYTHONPATH $PYTHONPATH:/var/myapp

WORKDIR /var/myapp

COPY . ./

RUN apk add --no-cache --update wget python3 python3-dev ca-certificates musl-dev libc-dev gcc bash postgresql-dev && \
    python3 -m ensurepip && \
    pip3 install --upgrade pip setuptools

RUN rm -r /root/.cache && \
    rm -r /usr/lib/python*/ensurepip

RUN pip3 install --upgrade pip && \
    pip3 install -r requirements-dev.txt

EXPOSE 8030

CMD gunicorn --reload --bind 0.0.0.0:8030 --pythonpath '/var/myapp' myapp.wsgi:application

@andriisoldatenko
Copy link
Collaborator

@digitaldavenyc What is sendgrid-django and python-sedngrid versions?

@digitaldavenyc
Copy link
Author

sendgrid-django==4.0.4
python-sendgrid==3.6.3

@elbuo8
Copy link
Owner

elbuo8 commented Jan 17, 2017

That seems like an error from the SG client. More specifically, looks like an issue from the API itself. @thinkingserious any insights?

@thinkingserious
Copy link

@elbuo8,

Hopefully the last comment on this thread will help: sendgrid/sendgrid-python#229

@hugotox
Copy link

hugotox commented Jun 13, 2017

+1

@thinkingserious
Copy link

This seems to be a solution: https://stackoverflow.com/a/42334357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants