-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
sam build --use-container fails hello_world when behind proxy. #913
Comments
Updated the issue. |
Ugh. I'll put the dirty solution in the morning. I deleted my repo on purpose forgetting that it was already forked. Planning to create a few fixes in the morning. |
FWIW, I got this error too but my issue was related to using Bundler v2.0.1 locally. Using this command below: docker run -v $(pwd):/var/task \
lambci/lambda:build-ruby2.5 \
bash -c "bundle install --without development test --verbose" I was able to find that my core issue was |
Here's a fix in progress. https://github.com/DevOpsChris/aws-sam-cli/tree/fix_container_build_proxy |
@metaskills That's definitely a decent dirty fix like mine was in the original post. Doesn't help solve the initial problem of starting the docker environment with the proxy env vars. I've coded up a way to pass in the vars with this new solution. |
What I've got left to do is write up the tests and this should be in. (fingers crossed) |
I'm not finding the problem anymore on my system. I recommend closing this. I believe my problem was not adding |
I'm running into the same issue and unfortunately adding http_proxy and https_proxy to the template.yml global environment variables is not resolving my issue. They don't seem to be set in the container when the pip install on my manifest file (requirements.txt) is called. Are you able to share an example of your SAM template that resolved the issue after adding proxy env variables? I'm wondering if mine are not placed in the right location of the YAML |
Have you set your proxy settings in the docker config? https://docs.docker.com/network/proxy/#configure-the-docker-client |
Yep, proxy settings are set in the docker config. After setting and restarting Docker to make sure it picks up the changes, I find when manually starting a Docker container, the proxy settings are getting set correctly and I have no issues hitting PIP: Manual Docker Proxy Test
However, when then running a sam build, I'm still not able to hit PIP, presumably due to missing proxy settings since I replicated the same error message by removing proxy settings from docker config: Sam Build Proxy Issue Remains
Still trying to come up with ways to debug this, but I'm running out of ideas at this point. Not sure why the SAM build doesn't seem to be picking up proxy settings from the docker config that it is reading from (based on logs highlighted above). Edit: Formatting |
Additional piece of confirmation. SAM Build Container Environment Variables - Missing Proxy Variables
|
here's my env settings in the yaml file. somethingLambda:
Properties:
......
DeploymentPreference:
...
Environment:
Variables:
....
http_proxy: http://proxyurl:proxyport
https_proxy: http://proxyurl:proxyport |
Description:
The hello_world example bombs everytime when following the written instructions when behind a proxy. Need to create a proxy flag or introduce passing proxy envs with the build command. Better yet, honor the .docker/config.json and service settings in your container code.
Also, really need to make logging or stderr MUCH better in https://github.com/awslabs/aws-lambda-builders, because it just says
instead of
It really misleads people when debugging.
Dirtiest Fix, put in proxy envs in env dictionary https://github.com/DevOpsChris/aws-sam-cli/blob/develop/samcli/local/docker/lambda_build_container.py#L77-L81
Best fix: Honor the environment settings the docker service provides.
Steps to reproduce the issue:
sam build --use-container
Observed result:
Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Output of
sam --version
: SAM CLI, version 0.10.0The text was updated successfully, but these errors were encountered: