Closed gamename closed 4 years ago
Did you happen to install pip 19.3? See this SAM issue: https://github.com/awslabs/aws-sam-cli/issues/1461
@hunterwerlla
Yes. That's it. I have pip 19.3 installed. I'll try lowering the pip version
@hunterwerlla That didn't work :( I downgraded my pip to 19.2.3 and get the same error
@hunterwerlla
I'm getting the same error when I try to create a function as well.
I created a "foo" project containing 3 files.
The file names are:
foo.py
template.yaml
requirements.txt
The contents:
python code file "foo.py":
import boto3
def handler(event, context):
print("Event:" + str(event))
instance_id = event["ResourceProperties"]["Parameters"]["InstanceId"]
ec2 = boto3.resource('ec2')
instance = ec2.Instance(instance_id)
template file "template.yaml"
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
ServerlessFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: foo
Handler: foo.handler
CodeUri: ./
Runtime: python3.7
Timeout: 900
requirements file "requirements.txt":
boto3
The pip version is 19.0.3
The build output when trying to create the function is:
/usr/local/bin/sam build --template /Users/tennis.smith/PycharmProjects/test_lambda_toolkit_failure/.aws-sam/build/template.yaml --build-dir /Users/tennis.smith/PycharmProjects/test_lambda_toolkit_failure/.aws-sam/build Function
Building resource 'Function'
Running PythonPipBuilder:ResolveDependencies
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'module' object is not callable
Sam uses the python on your PATH so check that.
You could also try building in the container. It's a checkbox on the upload dialog.
@abrooksv
Good idea. Will try that.
@abrooksv I can rule out the path because I'm running in a venv.
As for the building in a container, I don't see that option on the upload dialog. Where is it?
@gamename it's on the "SAM CLI" page
@hunterwerlla @abrooksv Ok. I found the option in "SAM CLI". I enabled that option, then tried to upload the function again. Same error.
What does building it in a container prove?
Re-read the code, we didn't wire the create/update dialog to the build in container option. :/
Also SAM ignores virtualenvs since it needs to use the same python version as the runtime so that it can compile wheels that are compatible with Lambda. So it will take whatever Python is on your path that matches the runtime of the Lambda and use its pip.
@abrooksv
I found the problem. There was a 19.3 pip version in my environment. Doing a which -a
showed it.
I downgraded the pip to 19.2 and everything works. Thanks guys. :)
Describe the bug
There is a known-to-be-good lambda function already installed on AWS. When I try to update the function code, I get the following error:
Even if I comment out the entire file except the function handler, I get the same error.
To reproduce Right-click on the function name in the "Lambda" area on the "AWS Explorer" Choose "Update Function Code"
Expected behavior It should have updated my lambda function
Screenshots
Your Environment
Additional context