Skip to content

Connection broken by SSLError #267

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

Closed
tainguyen206 opened this issue Oct 11, 2018 · 11 comments · Fixed by #271
Closed

Connection broken by SSLError #267

tainguyen206 opened this issue Oct 11, 2018 · 11 comments · Fixed by #271

Comments

@tainguyen206
Copy link

Hi,

I am able to use the plugin on my home machine. However, running sls package at my work machine (Win10) return this error:

Collecting numpy==1.14.5 (from -r /var/task/requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),)': /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)'),))

It seems like some proxy / certificate issues. I am not familiar with linux or networking so not so sure how to get around it. I specified the proxies server in docker setting with no luck.

Has anyone seen similar issue?

@dschep
Copy link
Contributor

dschep commented Oct 11, 2018

have you tried setting the http_proxy or https_proxy environment variables?

@dschep
Copy link
Contributor

dschep commented Oct 11, 2018

oh. you're using docker. the plugin would have to pass those through 🤔

@tainguyen206
Copy link
Author

Thanks @dschep. I did added http(s)_proxy variables to my local machine. But I am not sure how to pass those along with the plugin. Is there some obvious option that i missed? :-s

@dschep
Copy link
Contributor

dschep commented Oct 12, 2018

Nope. No obvious solution for you.

Not too difficult to addres, but I'm unsure how I want to approach this. I see 3 options:

  • Pass http_proxy & https_proxy env vars (any other vars that might be interesting to pass if we're hard coding some?)
  • Pass all env vars
  • add an option to specify which env vars are passed. EG in your case:
custom:
  pythonRequirements:
     dockerizePip: true
     dockerEnvVars:
       - http_proxy
       - https_proxy

@bsamuel-ui
Copy link
Contributor

The quick answer is configuring it in docker but we're looking at how the plugin might handle this more gracefully.

@tainguyen206
Copy link
Author

Thanks @bsamuel-ui , i made the change per your suggestion and it seems to work 👍 I got some errors but probably from other configuration. I will test it out more.

Thanks!

dschep added a commit that referenced this issue Oct 23, 2018
Based on #231 & closes #267
@dschep
Copy link
Contributor

dschep commented Oct 23, 2018

Just realized that we've already got #231 which is the 2nd option I mentioned. Cleaned it up and opening a PR for you to tests.

@tainguyen206
Copy link
Author

@dschep , this is a bit silly. But how do I test it? :( where do i specify the env variables?

@dschep
Copy link
Contributor

dschep commented Oct 25, 2018

You don't have to specify any vars or options. Install the branch as I indicated in #271 and it should work. It passes ALL the environment variables to docker

@tainguyen206
Copy link
Author

I got this error after installing the branch:

Type Error ---------------------------------------------

  options.dockerEnv.forEach is not a function

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

TypeError: options.dockerEnv.forEach is not a function
    at installRequirements (C:\projects\wm-tc\node_modules\serverless-python-requirements\lib\pip.js:201:25)
    at installRequirementsIfNeeded (C:\projects\wm-tc\node_modules\serverless-python-requirements\lib\pip.js:457:3)
    at ServerlessPythonRequirements.installAllRequirements (C:\projects\wm-tc\node_modules\serverless-python-requirements\lib\pip.js:536:29)
From previous event:
    at PluginManager.invoke (C:\Users\nguyta\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:390:22)
    at PluginManager.run (C:\Users\nguyta\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:421:17)
    at variables.populateService.then.then (C:\Users\nguyta\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:157:33)
    at runCallback (timers.js:810:20)
    at tryOnImmediate (timers.js:768:5)
    at processImmediate [as _immediateCallback] (timers.js:745:5)
From previous event:
    at Serverless.run (C:\Users\nguyta\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:144:8)
    at serverless.init.then (C:\Users\nguyta\AppData\Roaming\npm\node_modules\serverless\bin\serverless:43:50)
    at <anonymous>

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           8.12.0
     Serverless Version:     1.32.0

@dschep
Copy link
Contributor

dschep commented Oct 26, 2018

oops. the docs aren't right. it doesn't do all env vars. I'll push a fix to the docs soon, but you want:

custom:
  pythonRequirements:
    dockerEnv:
      - https_proxy

dschep added a commit that referenced this issue Nov 8, 2018
* Add environment variables to docker run cmd

* Pass env vars to docker

Based on #231 & closes #267

* format

* fix docs

* Update README.md
bweigel pushed a commit to bweigel/serverless-python-requirements that referenced this issue Nov 17, 2018
* Add environment variables to docker run cmd

* Pass env vars to docker

Based on serverless#231 & closes serverless#267

* format

* fix docs

* Update README.md
bweigel pushed a commit to bweigel/serverless-python-requirements that referenced this issue Nov 17, 2018
* Add environment variables to docker run cmd

* Pass env vars to docker

Based on serverless#231 & closes serverless#267

* format

* fix docs

* Update README.md
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

Successfully merging a pull request may close this issue.

3 participants